public function LoggerChannelTest::test_setLoggers in Service Container 7
Same name and namespace in other branches
- 7.2 tests/src/Logger/LoggerChannelTest.php \Drupal\Tests\service_container\Logger\LoggerChannelTest::test_setLoggers()
@covers ::log() @covers ::setLoggers()
File
- tests/
src/ Logger/ LoggerChannelTest.php, line 69 - Contains \Drupal\Tests\service_container\Logger\LoggerChannelTest.
Class
- LoggerChannelTest
- @coversDefaultClass \Drupal\service_container\Logger\LoggerChannel
Namespace
Drupal\Tests\service_container\LoggerCode
public function test_setLoggers() {
$logger1 = \Mockery::mock('Psr\\Log\\LoggerInterface');
$logger2 = \Mockery::mock('Psr\\Log\\LoggerInterface');
// Note: We use globally()/ordered() in order to ensure that $logger2 is
// called first.
$logger2
->shouldReceive('log')
->globally()
->ordered()
->with(LogLevel::INFO, 'test-message', array(
'key' => 'value',
'channel' => 'test',
));
$logger1
->shouldReceive('log')
->globally()
->ordered()
->with(LogLevel::INFO, 'test-message', array(
'key' => 'value',
'channel' => 'test',
));
$this->loggerChannel
->setLoggers(array(
0 => array(
$logger1,
),
10 => array(
$logger2,
),
));
$this->loggerChannel
->log(LogLevel::INFO, 'test-message', array(
'key' => 'value',
));
}