diff --git a/core/modules/layout_builder/tests/src/Unit/SectionRenderTest.php b/core/modules/layout_builder/tests/src/Unit/SectionRenderTest.php index a149ff8467..8a401f23af 100644 --- a/core/modules/layout_builder/tests/src/Unit/SectionRenderTest.php +++ b/core/modules/layout_builder/tests/src/Unit/SectionRenderTest.php @@ -12,6 +12,7 @@ use Drupal\Core\Layout\LayoutDefinition; use Drupal\Core\Layout\LayoutInterface; use Drupal\Core\Layout\LayoutPluginManagerInterface; +use Drupal\Core\Logger\LoggerChannel; use Drupal\Core\Plugin\Context\ContextHandlerInterface; use Drupal\Core\Plugin\Context\ContextRepositoryInterface; use Drupal\Core\Plugin\ContextAwarePluginInterface; @@ -64,6 +65,13 @@ class SectionRenderTest extends UnitTestCase { */ protected $eventDispatcher; + /** + * The logger instance. + * + * @var \Psr\Log\LoggerInterface + */ + protected $logger; + /** * {@inheritdoc} */ @@ -76,9 +84,10 @@ protected function setUp(): void { $this->contextRepository = $this->prophesize(ContextRepositoryInterface::class); // @todo Refactor this into some better tests in https://www.drupal.org/node/2942605. $this->eventDispatcher = (new \ReflectionClass(ContainerAwareEventDispatcher::class))->newInstanceWithoutConstructor(); + $this->logger = new LoggerChannel('layout_builder'); $this->account = $this->prophesize(AccountInterface::class); - $subscriber = new BlockComponentRenderArray($this->account->reveal()); + $subscriber = new BlockComponentRenderArray($this->account->reveal(), $this->logger); $this->eventDispatcher->addSubscriber($subscriber); $layout = $this->prophesize(LayoutInterface::class); @@ -93,6 +102,7 @@ protected function setUp(): void { $container->set('context.handler', $this->contextHandler->reveal()); $container->set('context.repository', $this->contextRepository->reveal()); $container->set('event_dispatcher', $this->eventDispatcher); + $container->set('logger.channel.layout_builder', $this->logger); \Drupal::setContainer($container); }