diff --git a/core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php b/core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php index b6b953c9a2..e7082d968c 100644 --- a/core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php +++ b/core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Cache\Cache; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Logger\LoggerChannel; use Drupal\Core\Plugin\Context\ContextHandlerInterface; use Drupal\Core\Render\PreviewFallbackInterface; use Drupal\Core\Session\AccountInterface; @@ -67,11 +68,12 @@ protected function setUp(): void { $this->blockManager = $this->prophesize(BlockManagerInterface::class); $this->account = $this->prophesize(AccountInterface::class); - $this->logger = \Drupal::service('logger.channel.layout_builder'); + $this->logger = new LoggerChannel('layout_builder'); $container = new ContainerBuilder(); $container->set('plugin.manager.block', $this->blockManager->reveal()); $container->set('context.handler', $this->prophesize(ContextHandlerInterface::class)); + $container->set('logger.channel.layout_builder', $this->logger); \Drupal::setContainer($container); } @@ -189,7 +191,7 @@ public function testOnBuildRenderWithoutPreviewFallbackString($refinable_depende $in_preview = FALSE; $event = new SectionComponentBuildRenderArrayEvent($component, $contexts, $in_preview); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $translation = $this->prophesize(TranslationInterface::class); $translation->translateString(Argument::type(TranslatableMarkup::class)) @@ -262,7 +264,7 @@ public function testOnBuildRenderDenied($refinable_dependent_access) { $in_preview = FALSE; $event = new SectionComponentBuildRenderArrayEvent($component, $contexts, $in_preview); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $expected_build = []; $expected_cache = [ @@ -321,7 +323,7 @@ public function testOnBuildRenderInPreview($refinable_dependent_access) { $in_preview = TRUE; $event = new SectionComponentBuildRenderArrayEvent($component, $contexts, $in_preview); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $expected_build = [ '#theme' => 'block', @@ -378,7 +380,7 @@ public function testOnBuildRenderInPreviewEmptyBuild() { $component = new SectionComponent('some-uuid', 'some-region', ['id' => 'some_block_id']); $event = new SectionComponentBuildRenderArrayEvent($component, [], TRUE); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $translation = $this->prophesize(TranslationInterface::class); $translation->translateString(Argument::type(TranslatableMarkup::class)) ->willReturn($placeholder_string); @@ -438,7 +440,7 @@ public function testOnBuildRenderEmptyBuild() { $component = new SectionComponent('some-uuid', 'some-region', ['id' => 'some_block_id']); $event = new SectionComponentBuildRenderArrayEvent($component, [], FALSE); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $expected_build = []; @@ -486,7 +488,7 @@ public function testOnBuildRenderEmptyBuildWithCacheTags() { $component = new SectionComponent('some-uuid', 'some-region', ['id' => 'some_block_id']); $event = new SectionComponentBuildRenderArrayEvent($component, [], FALSE); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $expected_build = []; @@ -516,7 +518,7 @@ public function testOnBuildRenderNoBlock() { $in_preview = FALSE; $event = new SectionComponentBuildRenderArrayEvent($component, $contexts, $in_preview); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $expected_build = []; $expected_cache = [