public function NewRelicLoggerTest::testExceptionPassing in New Relic 8
Same name and namespace in other branches
- 2.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::testExceptionPassing()
- 2.0.x tests/src/Unit/Logger/NewRelicLoggerTest.php \Drupal\Tests\new_relic_rpm\Unit\Logger\NewRelicLoggerTest::testExceptionPassing()
Test that exceptions are being passed to the adapter.
File
- tests/
src/ Unit/ Logger/ NewRelicLoggerTest.php, line 122
Class
- NewRelicLoggerTest
- @coversDefaultClass \Drupal\new_relic_rpm\Logger\NewRelicLogger @group new_relic_rpm
Namespace
Drupal\Tests\new_relic_rpm\Unit\LoggerCode
public function testExceptionPassing() {
$exception = new \Exception('Some exception to be logged.');
$adapter = $this
->prophesize(NewRelicAdapterInterface::class);
$adapter
->logException($exception)
->shouldBeCalled();
$logger = $this
->getLogger($adapter
->reveal(), [
RfcLogLevel::ERROR,
]);
$logger
->log(RfcLogLevel::ERROR, 'My Log Message', self::$defaultContext + [
'exception' => $exception,
]);
}