You are here

public function NewRelicLoggerTest::testCreatesMessage 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::testCreatesMessage()
  2. 2.0.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::testCreatesMessage()

Test that we log a message.

@dataProvider getMessageTests

File

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

Class

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

Namespace

Drupal\Tests\new_relic_rpm\Unit\Logger

Code

public function testCreatesMessage($expectedPart) {
  $adapter = $this
    ->prophesize(NewRelicAdapterInterface::class);
  $adapter
    ->logError(Argument::containingString($expectedPart))
    ->shouldBeCalled();
  $logger = $this
    ->getLogger($adapter
    ->reveal(), [
    RfcLogLevel::CRITICAL,
  ]);
  $logger
    ->log(RfcLogLevel::CRITICAL, 'My Log Message', self::$defaultContext);
}