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']);
93 $checksum =
'098f6bcd4621d373cade4e832627b4f6';
94 $release =
'05a671c66aefea124cc08b76ea6d30bb';
96 $handler->handle($record);
98 $this->assertEquals($checksum, $ravenClient->lastData[
'checksum']);
99 $this->assertEquals($release, $ravenClient->lastData[
'release']);
107 $fingerprint =
array(
'{{ default }}',
'other value');
109 $handler->handle($record);
111 $this->assertEquals($fingerprint, $ravenClient->lastData[
'fingerprint']);
124 'email' =>
'test@test.com',
129 $ravenClient->user_context(
array(
'id' =>
'test_user_id'));
131 $handler->handle($recordWithContext);
132 $this->assertEquals($user, $ravenClient->lastData[
'user']);
135 $handler->handle($recordWithNoContext);
136 $this->assertInternalType(
'array', $ravenClient->context->user);
137 $this->assertSame(
'test_user_id', $ravenClient->context->user[
'id']);
140 $ravenClient->user_context(null);
141 $handler->handle($recordWithContext);
142 $this->assertEquals($user, $ravenClient->lastData[
'user']);
145 $handler->handle($recordWithNoContext);
146 $this->assertNull($ravenClient->context->user);
158 $handler->handle($record);
161 $this->assertEquals($record[
'message'], $ravenClient->lastData[
'message']);
170 $logFormatter = $this->getMock(
'Monolog\\Formatter\\FormatterInterface');
171 $logFormatter->expects($this->once())->method(
'formatBatch');
173 $formatter = $this->getMock(
'Monolog\\Formatter\\FormatterInterface');
174 $formatter->expects($this->once())->method(
'format')->with($this->callback(
function ($record) {
175 return $record[
'level'] == 400;
179 $handler->setBatchFormatter($logFormatter);
180 $handler->setFormatter($formatter);
192 $handler = $this->getMock(
'Monolog\Handler\RavenHandler', null,
array($this->
getRavenClient()));
193 $handler->expects($this->never())->method(
'handle');
203 $handler->setBatchFormatter($formatter =
new LineFormatter());
204 $this->assertSame($formatter, $handler->getBatchFormatter());
211 $release =
'v42.42.42';
212 $handler->setRelease($release);
214 $handler->handle($record);
215 $this->assertEquals($release, $ravenClient->lastData[
'release']);
217 $localRelease =
'v41.41.41';
219 $handler->handle($record);
220 $this->assertEquals($localRelease, $ravenClient->lastData[
'release']);
225 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()
Create styles array
The data for the language used.
testGetSetBatchFormatter()
Handler to send messages to a Sentry (https://github.com/getsentry/sentry) server using raven-php (ht...
const INFO
Interesting events.