You are here

public function LoggerChannelTest::test_log_singleLogger in Service Container 7

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

@covers ::log() @covers ::addLogger()

@dataProvider providerLogLevels

File

tests/src/Logger/LoggerChannelTest.php, line 48
Contains \Drupal\Tests\service_container\Logger\LoggerChannelTest.

Class

LoggerChannelTest
@coversDefaultClass \Drupal\service_container\Logger\LoggerChannel

Namespace

Drupal\Tests\service_container\Logger

Code

public function test_log_singleLogger($log_method = NULL, $log_level = LogLevel::INFO) {
  $logger = \Mockery::mock('Psr\\Log\\LoggerInterface');
  $logger
    ->shouldReceive('log')
    ->with($log_level, 'test-message', array(
    'key' => 'value',
    'channel' => 'test',
  ));
  $this->loggerChannel
    ->addLogger($logger);
  if (is_null($log_method)) {
    $this->loggerChannel
      ->log($log_level, 'test-message', array(
      'key' => 'value',
    ));
  }
  else {
    $this->loggerChannel
      ->{$log_method}('test-message', array(
      'key' => 'value',
    ));
  }
}