You are here

public function LoggerChannelFactoryTest::test_get_withExistingLoggersWithPriority 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_get_withExistingLoggersWithPriority()

@covers ::get() @covers ::addLogger()

File

tests/src/Logger/LoggerChannelFactoryTest.php, line 67
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_get_withExistingLoggersWithPriority() {
  $logger1 = \Mockery::mock('Psr\\Log\\LoggerInterface');
  $logger2 = \Mockery::mock('Psr\\Log\\LoggerInterface');
  $this->loggerChannelFactory
    ->addLogger($logger1, 0);
  $this->loggerChannelFactory
    ->addLogger($logger2, 10);
  $logger_channel = $this->loggerChannelFactory
    ->get('test');
  $this
    ->assertAttributeEquals(array(
    0 => array(
      $logger1,
    ),
    10 => array(
      $logger2,
    ),
  ), 'loggers', $logger_channel);
}