You are here

public function LoggerChannelFactoryTest::test_addLogger_withExistingLoggerChannel in Service Container 7

Same name and namespace in other branches
  1. 7.2 tests/src/Logger/LoggerChannelFactoryTest.php \Drupal\Tests\service_container\Logger\LoggerChannelFactoryTest::test_addLogger_withExistingLoggerChannel()

@covers ::addLogger()

File

tests/src/Logger/LoggerChannelFactoryTest.php, line 81
Contains \Drupal\Tests\service_container\Logger\LoggerChannelFactoryTest.

Class

LoggerChannelFactoryTest
@coversDefaultClass \Drupal\service_container\Logger\LoggerChannelFactory

Namespace

Drupal\Tests\service_container\Logger

Code

public function test_addLogger_withExistingLoggerChannel() {
  $logger_channel1 = $this->loggerChannelFactory
    ->get('test');
  $logger_channel2 = $this->loggerChannelFactory
    ->get('test2');
  $logger = \Mockery::mock('Psr\\Log\\LoggerInterface');
  $this->loggerChannelFactory
    ->addLogger($logger);
  $this
    ->assertAttributeEquals(array(
    0 => array(
      $logger,
    ),
  ), 'loggers', $logger_channel1);
  $this
    ->assertAttributeEquals(array(
    0 => array(
      $logger,
    ),
  ), 'loggers', $logger_channel2);
}