You are here

public function NewRelicLoggerTest::testLogsSelectedLevelMessages in New Relic 8

Same name and namespace in other branches
  1. 2.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::testLogsSelectedLevelMessages()
  2. 2.0.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::testLogsSelectedLevelMessages()

Test that log levels requested are logged.

File

tests/src/Unit/Logger/NewRelicLoggerTest.php, line 55

Class

NewRelicLoggerTest
@coversDefaultClass \Drupal\new_relic_rpm\Logger\NewRelicLogger @group new_relic_rpm

Namespace

Drupal\Tests\new_relic_rpm\Unit\Logger

Code

public function testLogsSelectedLevelMessages() {
  $adapter = $this
    ->prophesize(NewRelicAdapterInterface::class);
  $adapter
    ->logError(Argument::type('string'))
    ->shouldBeCalled();
  $logger = $this
    ->getLogger($adapter
    ->reveal(), [
    RfcLogLevel::CRITICAL,
  ]);
  $logger
    ->log(RfcLogLevel::CRITICAL, 'Test', self::$defaultContext);
}