22 if (!class_exists(
'Raven_Client')) {
23 $this->markTestSkipped(
'raven/raven not installed');
26 require_once __DIR__ .
'/MockRavenClient.php';
35 $this->assertInstanceOf(
'Monolog\Handler\RavenHandler', $handler);
47 $dsn =
'http://43f6017361224d098402974103bfc53d:a6a0538fc2934ba2bed32e08741b2cd3@marca.python.live.cheggnet.com:9000/1';
58 $handler->handle($record);
61 $this->assertContains($record[
'message'], $ravenClient->lastData[
'message']);
70 $handler->handle($record);
72 $this->assertEquals($ravenClient::WARNING, $ravenClient->lastData[
'level']);
73 $this->assertContains($record[
'message'], $ravenClient->lastData[
'message']);
81 $tags = array(1, 2,
'foo');
83 $handler->handle($record);
85 $this->assertEquals($tags, $ravenClient->lastData[
'tags']);
98 'email' =>
'test@test.com' 103 $ravenClient->user_context(array(
'id' =>
'test_user_id'));
105 $handler->handle($recordWithContext);
106 $this->assertEquals($user, $ravenClient->lastData[
'sentry.interfaces.User']);
109 $handler->handle($recordWithNoContext);
110 $this->assertInternalType(
'array', $ravenClient->context->user);
111 $this->assertSame(
'test_user_id', $ravenClient->context->user[
'id']);
114 $ravenClient->user_context(null);
115 $handler->handle($recordWithContext);
116 $this->assertEquals($user, $ravenClient->lastData[
'sentry.interfaces.User']);
119 $handler->handle($recordWithNoContext);
120 $this->assertNull($ravenClient->context->user);
132 $handler->handle($record);
135 $this->assertEquals($record[
'message'], $ravenClient->lastData[
'message']);
144 $logFormatter = $this->getMock(
'Monolog\\Formatter\\FormatterInterface');
145 $logFormatter->expects($this->once())->method(
'formatBatch');
147 $formatter = $this->getMock(
'Monolog\\Formatter\\FormatterInterface');
148 $formatter->expects($this->once())->method(
'format')->with($this->callback(
function ($record) {
149 return $record[
'level'] == 400;
153 $handler->setBatchFormatter($logFormatter);
154 $handler->setFormatter($formatter);
166 $handler = $this->getMock(
'Monolog\Handler\RavenHandler', null, array($this->
getRavenClient()));
167 $handler->expects($this->never())->method(
'handle');
177 $handler->setBatchFormatter($formatter =
new LineFormatter());
178 $this->assertSame($formatter, $handler->getBatchFormatter());
183 throw new \Exception(
'This is an exception');
const DEBUG
Detailed debug information.
const ERROR
Runtime errors.
testConstruct()
Monolog::__construct
methodThatThrowsAnException()
getRecord($level=Logger::WARNING, $message='test', $context=array())
const WARNING
Exceptional occurrences that are not errors.
testHandleBatchDoNothingIfRecordsAreBelowLevel()
testGetSetBatchFormatter()
Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server using raven-php (ht...
const INFO
Interesting events.