function LoggerAwarePassTest::testLoggerAwarePass

Same name in other branches
  1. 10 core/modules/system/tests/src/Kernel/DependencyInjection/CompilerPass/LoggerAwarePassTest.php \Drupal\Tests\system\Kernel\DependencyInjection\CompilerPass\LoggerAwarePassTest::testLoggerAwarePass()

Tests that the logger aware compiler pass works.

@covers ::process

File

core/modules/system/tests/src/Kernel/DependencyInjection/CompilerPass/LoggerAwarePassTest.php, line 33

Class

LoggerAwarePassTest
Tests the logger aware compiler pass.

Namespace

Drupal\Tests\system\Kernel\DependencyInjection\CompilerPass

Code

public function testLoggerAwarePass() : void {
    $container = $this->container;
    $logger = $container->get('logger.channel.logger_aware_test');
    $this->assertInstanceOf(LoggerInterface::class, $logger);
    $logger_aware_stub = $container->get('logger_aware_test.logger_aware_stub');
    $this->assertInstanceOf(LoggerAwareStub::class, $logger_aware_stub);
    $this->assertSame($logger, $logger_aware_stub->getLogger());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.