@@ -35,6 +35,9 @@ |
||
35 | 35 | $this->assertInstanceOf('Monolog\Handler\RavenHandler', $handler); |
36 | 36 | } |
37 | 37 | |
38 | + /** |
|
39 | + * @param MockRavenClient $ravenClient |
|
40 | + */ |
|
38 | 41 | protected function getHandler($ravenClient) |
39 | 42 | { |
40 | 43 | $handler = new RavenHandler($ravenClient); |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\TestCase; |
|
15 | -use Monolog\Logger; |
|
16 | 14 | use Monolog\Formatter\LineFormatter; |
15 | +use Monolog\Logger; |
|
16 | +use Monolog\TestCase; |
|
17 | 17 | |
18 | 18 | class RavenHandlerTest extends TestCase |
19 | 19 | { |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $this->markTestSkipped('raven/raven not installed'); |
24 | 24 | } |
25 | 25 | |
26 | - require_once __DIR__ . '/MockRavenClient.php'; |
|
26 | + require_once __DIR__.'/MockRavenClient.php'; |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $logFormatter->expects($this->once())->method('formatBatch'); |
174 | 174 | |
175 | 175 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
176 | - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) { |
|
176 | + $formatter->expects($this->once())->method('format')->with($this->callback(function($record){ |
|
177 | 177 | return $record['level'] == 400; |
178 | 178 | })); |
179 | 179 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $logFormatter->expects($this->once())->method('formatBatch'); |
214 | 214 | |
215 | 215 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
216 | - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) { |
|
216 | + $formatter->expects($this->once())->method('format')->with($this->callback(function($record) use ($records) { |
|
217 | 217 | return $record['message'] == 'error 1'; |
218 | 218 | })); |
219 | 219 |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $logFormatter->expects($this->once())->method('formatBatch'); |
174 | 174 | |
175 | 175 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
176 | - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) { |
|
176 | + $formatter->expects($this->once())->method('format')->with($this->callback(function ($record){ |
|
177 | 177 | return $record['level'] == 400; |
178 | 178 | })); |
179 | 179 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $logFormatter->expects($this->once())->method('formatBatch'); |
214 | 214 | |
215 | 215 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
216 | - $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records) { |
|
216 | + $formatter->expects($this->once())->method('format')->with($this->callback(function ($record) use ($records){ |
|
217 | 217 | return $record['message'] == 'error 1'; |
218 | 218 | })); |
219 | 219 |
@@ -11,9 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\TestCase; |
|
15 | -use Monolog\Logger; |
|
16 | 14 | use Monolog\Formatter\LineFormatter; |
15 | +use Monolog\Logger; |
|
16 | +use Monolog\TestCase; |
|
17 | 17 | |
18 | 18 | class RedisHandlerTest extends TestCase |
19 | 19 | { |
@@ -114,7 +114,7 @@ |
||
114 | 114 | // Redis uses multi |
115 | 115 | $redis->expects($this->once()) |
116 | 116 | ->method('transaction') |
117 | - ->will($this->returnCallback(function ($cb) use ($redisTransaction) { |
|
117 | + ->will($this->returnCallback(function($cb) use ($redisTransaction) { |
|
118 | 118 | $cb($redisTransaction); |
119 | 119 | })); |
120 | 120 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | // Redis uses multi |
115 | 115 | $redis->expects($this->once()) |
116 | 116 | ->method('transaction') |
117 | - ->will($this->returnCallback(function ($cb) use ($redisTransaction) { |
|
117 | + ->will($this->returnCallback(function ($cb) use ($redisTransaction){ |
|
118 | 118 | $cb($redisTransaction); |
119 | 119 | })); |
120 | 120 |
@@ -282,12 +282,18 @@ |
||
282 | 282 | $this->writeRecord('Hello world'); |
283 | 283 | } |
284 | 284 | |
285 | + /** |
|
286 | + * @param string $connectionString |
|
287 | + */ |
|
285 | 288 | private function createHandler($connectionString) |
286 | 289 | { |
287 | 290 | $this->handler = new SocketHandler($connectionString); |
288 | 291 | $this->handler->setFormatter($this->getIdentityFormatter()); |
289 | 292 | } |
290 | 293 | |
294 | + /** |
|
295 | + * @param string $string |
|
296 | + */ |
|
291 | 297 | private function writeRecord($string) |
292 | 298 | { |
293 | 299 | $this->handler->handle($this->getRecord(Logger::WARNING, $string)); |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\TestCase; |
|
15 | 14 | use Monolog\Logger; |
15 | +use Monolog\TestCase; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @author Pablo de Leon Belloc <[email protected]> |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $this->setMockHandler(array('fwrite')); |
149 | 149 | |
150 | - $callback = function ($arg) { |
|
150 | + $callback = function($arg){ |
|
151 | 151 | $map = array( |
152 | 152 | 'Hello world' => 6, |
153 | 153 | 'world' => false, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $this->setMockHandler(array('fwrite', 'streamGetMetadata')); |
172 | 172 | |
173 | - $callback = function ($arg) { |
|
173 | + $callback = function($arg){ |
|
174 | 174 | $map = array( |
175 | 175 | 'Hello world' => 6, |
176 | 176 | 'world' => 5, |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $this->setMockHandler(array('fwrite', 'streamGetMetadata')); |
198 | 198 | |
199 | 199 | $res = $this->res; |
200 | - $callback = function ($string) use ($res) { |
|
200 | + $callback = function($string) use ($res) { |
|
201 | 201 | fclose($res); |
202 | 202 | |
203 | 203 | return strlen('Hello'); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $this->setMockHandler(array('fwrite')); |
229 | 229 | |
230 | - $callback = function ($arg) { |
|
230 | + $callback = function($arg){ |
|
231 | 231 | $map = array( |
232 | 232 | 'Hello world' => 6, |
233 | 233 | 'world' => 5, |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $this->setMockHandler(array('fwrite')); |
149 | 149 | |
150 | - $callback = function ($arg) { |
|
150 | + $callback = function ($arg){ |
|
151 | 151 | $map = array( |
152 | 152 | 'Hello world' => 6, |
153 | 153 | 'world' => false, |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | { |
171 | 171 | $this->setMockHandler(array('fwrite', 'streamGetMetadata')); |
172 | 172 | |
173 | - $callback = function ($arg) { |
|
173 | + $callback = function ($arg){ |
|
174 | 174 | $map = array( |
175 | 175 | 'Hello world' => 6, |
176 | 176 | 'world' => 5, |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | $this->setMockHandler(array('fwrite', 'streamGetMetadata')); |
198 | 198 | |
199 | 199 | $res = $this->res; |
200 | - $callback = function ($string) use ($res) { |
|
200 | + $callback = function ($string) use ($res){ |
|
201 | 201 | fclose($res); |
202 | 202 | |
203 | 203 | return strlen('Hello'); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | { |
228 | 228 | $this->setMockHandler(array('fwrite')); |
229 | 229 | |
230 | - $callback = function ($arg) { |
|
230 | + $callback = function ($arg){ |
|
231 | 231 | $map = array( |
232 | 232 | 'Hello world' => 6, |
233 | 233 | 'world' => 5, |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\TestCase; |
|
15 | 14 | use Monolog\Logger; |
15 | +use Monolog\TestCase; |
|
16 | 16 | |
17 | 17 | class StreamHandlerTest extends TestCase |
18 | 18 | { |
@@ -75,7 +75,7 @@ |
||
75 | 75 | */ |
76 | 76 | public function testWriteLocking() |
77 | 77 | { |
78 | - $temp = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'monolog_locked_log'; |
|
78 | + $temp = sys_get_temp_dir().DIRECTORY_SEPARATOR.'monolog_locked_log'; |
|
79 | 79 | $handler = new StreamHandler($temp, Logger::DEBUG, true, null, true); |
80 | 80 | $handler->handle($this->getRecord()); |
81 | 81 | } |
@@ -69,6 +69,9 @@ |
||
69 | 69 | $handler->handle($this->getRecordWithMessage(null)); |
70 | 70 | } |
71 | 71 | |
72 | + /** |
|
73 | + * @param string|null $msg |
|
74 | + */ |
|
72 | 75 | protected function getRecordWithMessage($msg) |
73 | 76 | { |
74 | 77 | return array('message' => $msg, 'level' => \Monolog\Logger::WARNING, 'context' => null, 'extra' => array(), 'channel' => 'lol'); |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog\Handler; |
13 | 13 | |
14 | -use Monolog\TestCase; |
|
15 | 14 | use Monolog\Logger; |
15 | +use Monolog\TestCase; |
|
16 | 16 | |
17 | 17 | /** |
18 | 18 | * @covers Monolog\Handler\TestHandler |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->assertFalse($handler->hasRecord($record, $level)); |
31 | 31 | $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method); |
32 | 32 | $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); |
33 | - $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) { |
|
33 | + $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function($rec){ |
|
34 | 34 | return true; |
35 | 35 | }), 'has'.$method.'ThatPasses'); |
36 | 36 | $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method); |
44 | 44 | $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method); |
45 | 45 | $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); |
46 | - $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) { |
|
46 | + $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function($rec){ |
|
47 | 47 | return true; |
48 | 48 | }), 'has'.$method.'ThatPasses'); |
49 | 49 | $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $this->assertEquals(array($record), $records); |
55 | 55 | } |
56 | 56 | |
57 | - public function testHandlerAssertEmptyContext() { |
|
57 | + public function testHandlerAssertEmptyContext(){ |
|
58 | 58 | $handler = new TestHandler; |
59 | 59 | $record = $this->getRecord(Logger::WARNING, 'test', array()); |
60 | 60 | $this->assertFalse($handler->hasWarning(array( |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ))); |
77 | 77 | } |
78 | 78 | |
79 | - public function testHandlerAssertNonEmptyContext() { |
|
79 | + public function testHandlerAssertNonEmptyContext(){ |
|
80 | 80 | $handler = new TestHandler; |
81 | 81 | $record = $this->getRecord(Logger::WARNING, 'test', array('foo' => 'bar')); |
82 | 82 | $this->assertFalse($handler->hasWarning(array( |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | { |
105 | 105 | return array( |
106 | 106 | array('Emergency', Logger::EMERGENCY), |
107 | - array('Alert' , Logger::ALERT), |
|
108 | - array('Critical' , Logger::CRITICAL), |
|
109 | - array('Error' , Logger::ERROR), |
|
110 | - array('Warning' , Logger::WARNING), |
|
111 | - array('Info' , Logger::INFO), |
|
112 | - array('Notice' , Logger::NOTICE), |
|
113 | - array('Debug' , Logger::DEBUG), |
|
107 | + array('Alert', Logger::ALERT), |
|
108 | + array('Critical', Logger::CRITICAL), |
|
109 | + array('Error', Logger::ERROR), |
|
110 | + array('Warning', Logger::WARNING), |
|
111 | + array('Info', Logger::INFO), |
|
112 | + array('Notice', Logger::NOTICE), |
|
113 | + array('Debug', Logger::DEBUG), |
|
114 | 114 | ); |
115 | 115 | } |
116 | 116 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $this->assertFalse($handler->hasRecord($record, $level)); |
31 | 31 | $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method); |
32 | 32 | $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); |
33 | - $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) { |
|
33 | + $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec){ |
|
34 | 34 | return true; |
35 | 35 | }), 'has'.$method.'ThatPasses'); |
36 | 36 | $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method); |
44 | 44 | $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method); |
45 | 45 | $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains'); |
46 | - $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) { |
|
46 | + $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec){ |
|
47 | 47 | return true; |
48 | 48 | }), 'has'.$method.'ThatPasses'); |
49 | 49 | $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/')); |
@@ -54,7 +54,8 @@ discard block |
||
54 | 54 | $this->assertEquals(array($record), $records); |
55 | 55 | } |
56 | 56 | |
57 | - public function testHandlerAssertEmptyContext() { |
|
57 | + public function testHandlerAssertEmptyContext() |
|
58 | + { |
|
58 | 59 | $handler = new TestHandler; |
59 | 60 | $record = $this->getRecord(Logger::WARNING, 'test', array()); |
60 | 61 | $this->assertFalse($handler->hasWarning(array( |
@@ -76,7 +77,8 @@ discard block |
||
76 | 77 | ))); |
77 | 78 | } |
78 | 79 | |
79 | - public function testHandlerAssertNonEmptyContext() { |
|
80 | + public function testHandlerAssertNonEmptyContext() |
|
81 | + { |
|
80 | 82 | $handler = new TestHandler; |
81 | 83 | $record = $this->getRecord(Logger::WARNING, 'test', array('foo' => 'bar')); |
82 | 84 | $this->assertFalse($handler->hasWarning(array( |
@@ -11,8 +11,8 @@ |
||
11 | 11 | |
12 | 12 | namespace Monolog; |
13 | 13 | |
14 | -use Monolog\Processor\WebProcessor; |
|
15 | 14 | use Monolog\Handler\TestHandler; |
15 | +use Monolog\Processor\WebProcessor; |
|
16 | 16 | |
17 | 17 | class LoggerTest extends \PHPUnit_Framework_TestCase |
18 | 18 | { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $logger = new Logger(__METHOD__); |
215 | 215 | $handler = new TestHandler; |
216 | 216 | $logger->pushHandler($handler); |
217 | - $logger->pushProcessor(function ($record) { |
|
217 | + $logger->pushProcessor(function($record){ |
|
218 | 218 | $record['extra']['win'] = true; |
219 | 219 | |
220 | 220 | return $record; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ; |
269 | 269 | $logger->pushHandler($handler); |
270 | 270 | $that = $this; |
271 | - $logger->pushProcessor(function ($record) use ($that) { |
|
271 | + $logger->pushProcessor(function($record) use ($that) { |
|
272 | 272 | $that->fail('The processor should not be called'); |
273 | 273 | }); |
274 | 274 | $logger->addAlert('test'); |
@@ -477,24 +477,24 @@ discard block |
||
477 | 477 | { |
478 | 478 | return array( |
479 | 479 | // monolog methods |
480 | - array('addDebug', Logger::DEBUG), |
|
481 | - array('addInfo', Logger::INFO), |
|
482 | - array('addNotice', Logger::NOTICE), |
|
483 | - array('addWarning', Logger::WARNING), |
|
484 | - array('addError', Logger::ERROR), |
|
485 | - array('addCritical', Logger::CRITICAL), |
|
486 | - array('addAlert', Logger::ALERT), |
|
480 | + array('addDebug', Logger::DEBUG), |
|
481 | + array('addInfo', Logger::INFO), |
|
482 | + array('addNotice', Logger::NOTICE), |
|
483 | + array('addWarning', Logger::WARNING), |
|
484 | + array('addError', Logger::ERROR), |
|
485 | + array('addCritical', Logger::CRITICAL), |
|
486 | + array('addAlert', Logger::ALERT), |
|
487 | 487 | array('addEmergency', Logger::EMERGENCY), |
488 | 488 | |
489 | 489 | // ZF/Sf2 compat methods |
490 | - array('debug', Logger::DEBUG), |
|
491 | - array('info', Logger::INFO), |
|
490 | + array('debug', Logger::DEBUG), |
|
491 | + array('info', Logger::INFO), |
|
492 | 492 | array('notice', Logger::NOTICE), |
493 | - array('warn', Logger::WARNING), |
|
494 | - array('err', Logger::ERROR), |
|
495 | - array('crit', Logger::CRITICAL), |
|
496 | - array('alert', Logger::ALERT), |
|
497 | - array('emerg', Logger::EMERGENCY), |
|
493 | + array('warn', Logger::WARNING), |
|
494 | + array('err', Logger::ERROR), |
|
495 | + array('crit', Logger::CRITICAL), |
|
496 | + array('alert', Logger::ALERT), |
|
497 | + array('emerg', Logger::EMERGENCY), |
|
498 | 498 | ); |
499 | 499 | } |
500 | 500 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | public function setTimezoneProvider() |
517 | 517 | { |
518 | 518 | return array_map( |
519 | - function ($tz) { return array(new \DateTimeZone($tz)); }, |
|
519 | + function($tz){ return array(new \DateTimeZone($tz)); }, |
|
520 | 520 | \DateTimeZone::listIdentifiers() |
521 | 521 | ); |
522 | 522 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | { |
554 | 554 | $logger = new Logger(__METHOD__); |
555 | 555 | $this->assertNull($logger->getExceptionHandler()); |
556 | - $callback = function ($ex) { |
|
556 | + $callback = function($ex){ |
|
557 | 557 | }; |
558 | 558 | $logger->setExceptionHandler($callback); |
559 | 559 | $this->assertEquals($callback, $logger->getExceptionHandler()); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | { |
598 | 598 | $logger = new Logger(__METHOD__); |
599 | 599 | $that = $this; |
600 | - $logger->setExceptionHandler(function ($e, $record) use ($that) { |
|
600 | + $logger->setExceptionHandler(function($e, $record) use ($that) { |
|
601 | 601 | $that->assertEquals($e->getMessage(), 'Some handler exception'); |
602 | 602 | $that->assertTrue(is_array($record)); |
603 | 603 | $that->assertEquals($record['message'], 'test'); |
@@ -634,14 +634,14 @@ discard block |
||
634 | 634 | $uid2 = $processorUid2->getUid(); |
635 | 635 | $logger->pushProcessor($processorUid2); |
636 | 636 | |
637 | - $getProperty = function ($object, $property) { |
|
637 | + $getProperty = function($object, $property){ |
|
638 | 638 | $reflectionProperty = new \ReflectionProperty(get_class($object), $property); |
639 | 639 | $reflectionProperty->setAccessible(true); |
640 | 640 | |
641 | 641 | return $reflectionProperty->getValue($object); |
642 | 642 | }; |
643 | 643 | $that = $this; |
644 | - $assertBufferOfBufferHandlerEmpty = function () use ($getProperty, $bufferHandler, $that) { |
|
644 | + $assertBufferOfBufferHandlerEmpty = function() use ($getProperty, $bufferHandler, $that) { |
|
645 | 645 | $that->assertEmpty($getProperty($bufferHandler, 'buffer')); |
646 | 646 | }; |
647 | 647 | $assertBuffersEmpty = function() use ($assertBufferOfBufferHandlerEmpty, $getProperty, $fingersCrossedHandler, $that) { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $logger = new Logger(__METHOD__); |
215 | 215 | $handler = new TestHandler; |
216 | 216 | $logger->pushHandler($handler); |
217 | - $logger->pushProcessor(function ($record) { |
|
217 | + $logger->pushProcessor(function ($record){ |
|
218 | 218 | $record['extra']['win'] = true; |
219 | 219 | |
220 | 220 | return $record; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ; |
269 | 269 | $logger->pushHandler($handler); |
270 | 270 | $that = $this; |
271 | - $logger->pushProcessor(function ($record) use ($that) { |
|
271 | + $logger->pushProcessor(function ($record) use ($that){ |
|
272 | 272 | $that->fail('The processor should not be called'); |
273 | 273 | }); |
274 | 274 | $logger->addAlert('test'); |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | { |
554 | 554 | $logger = new Logger(__METHOD__); |
555 | 555 | $this->assertNull($logger->getExceptionHandler()); |
556 | - $callback = function ($ex) { |
|
556 | + $callback = function ($ex){ |
|
557 | 557 | }; |
558 | 558 | $logger->setExceptionHandler($callback); |
559 | 559 | $this->assertEquals($callback, $logger->getExceptionHandler()); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | { |
598 | 598 | $logger = new Logger(__METHOD__); |
599 | 599 | $that = $this; |
600 | - $logger->setExceptionHandler(function ($e, $record) use ($that) { |
|
600 | + $logger->setExceptionHandler(function ($e, $record) use ($that){ |
|
601 | 601 | $that->assertEquals($e->getMessage(), 'Some handler exception'); |
602 | 602 | $that->assertTrue(is_array($record)); |
603 | 603 | $that->assertEquals($record['message'], 'test'); |
@@ -634,17 +634,17 @@ discard block |
||
634 | 634 | $uid2 = $processorUid2->getUid(); |
635 | 635 | $logger->pushProcessor($processorUid2); |
636 | 636 | |
637 | - $getProperty = function ($object, $property) { |
|
637 | + $getProperty = function ($object, $property){ |
|
638 | 638 | $reflectionProperty = new \ReflectionProperty(get_class($object), $property); |
639 | 639 | $reflectionProperty->setAccessible(true); |
640 | 640 | |
641 | 641 | return $reflectionProperty->getValue($object); |
642 | 642 | }; |
643 | 643 | $that = $this; |
644 | - $assertBufferOfBufferHandlerEmpty = function () use ($getProperty, $bufferHandler, $that) { |
|
644 | + $assertBufferOfBufferHandlerEmpty = function () use ($getProperty, $bufferHandler, $that){ |
|
645 | 645 | $that->assertEmpty($getProperty($bufferHandler, 'buffer')); |
646 | 646 | }; |
647 | - $assertBuffersEmpty = function() use ($assertBufferOfBufferHandlerEmpty, $getProperty, $fingersCrossedHandler, $that) { |
|
647 | + $assertBuffersEmpty = function() use ($assertBufferOfBufferHandlerEmpty, $getProperty, $fingersCrossedHandler, $that){ |
|
648 | 648 | $assertBufferOfBufferHandlerEmpty(); |
649 | 649 | $that->assertEmpty($getProperty($fingersCrossedHandler, 'buffer')); |
650 | 650 | }; |
@@ -55,6 +55,9 @@ |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | + /** |
|
59 | + * @param integer $handler |
|
60 | + */ |
|
58 | 61 | private function setSignalHandler($signo, $handler = SIG_DFL) { |
59 | 62 | if (function_exists('pcntl_signal_get_handler')) { |
60 | 63 | $this->signalHandlers[$signo] = pcntl_signal_get_handler($signo); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - private function setSignalHandler($signo, $handler = SIG_DFL) { |
|
58 | + private function setSignalHandler($signo, $handler = SIG_DFL){ |
|
59 | 59 | if (function_exists('pcntl_signal_get_handler')) { |
60 | 60 | $this->signalHandlers[$signo] = pcntl_signal_get_handler($signo); |
61 | 61 | } else { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | { |
69 | 69 | $logger = new Logger('test', array($handler = new TestHandler)); |
70 | 70 | $errHandler = new SignalHandler($logger); |
71 | - $signo = 2; // SIGINT. |
|
71 | + $signo = 2; // SIGINT. |
|
72 | 72 | $siginfo = array('signo' => $signo, 'errno' => 0, 'code' => 0); |
73 | 73 | $errHandler->handleSignal($signo, $siginfo); |
74 | 74 | $this->assertCount(1, $handler->getRecords()); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $logger = new Logger('test', array($handler = new TestHandler)); |
181 | 181 | $errHandler = new SignalHandler($logger); |
182 | 182 | $previousCalled = 0; |
183 | - pcntl_signal(SIGURG, function ($signo, array $siginfo = null) use (&$previousCalled) { |
|
183 | + pcntl_signal(SIGURG, function($signo, array $siginfo = null) use (&$previousCalled) { |
|
184 | 184 | ++$previousCalled; |
185 | 185 | }); |
186 | 186 | $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, $callPrevious, false, false); |
@@ -55,7 +55,8 @@ discard block |
||
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | - private function setSignalHandler($signo, $handler = SIG_DFL) { |
|
58 | + private function setSignalHandler($signo, $handler = SIG_DFL) |
|
59 | + { |
|
59 | 60 | if (function_exists('pcntl_signal_get_handler')) { |
60 | 61 | $this->signalHandlers[$signo] = pcntl_signal_get_handler($signo); |
61 | 62 | } else { |
@@ -131,7 +132,8 @@ discard block |
||
131 | 132 | $this->assertNotFalse($path); |
132 | 133 | |
133 | 134 | $pid = pcntl_fork(); |
134 | - if ($pid === 0) { // Child. |
|
135 | + if ($pid === 0) { |
|
136 | +// Child. |
|
135 | 137 | $streamHandler = new StreamHandler($path); |
136 | 138 | $streamHandler->setFormatter($this->getIdentityFormatter()); |
137 | 139 | $logger = new Logger('test', array($streamHandler)); |
@@ -180,7 +182,7 @@ discard block |
||
180 | 182 | $logger = new Logger('test', array($handler = new TestHandler)); |
181 | 183 | $errHandler = new SignalHandler($logger); |
182 | 184 | $previousCalled = 0; |
183 | - pcntl_signal(SIGURG, function ($signo, array $siginfo = null) use (&$previousCalled) { |
|
185 | + pcntl_signal(SIGURG, function ($signo, array $siginfo = null) use (&$previousCalled){ |
|
184 | 186 | ++$previousCalled; |
185 | 187 | }); |
186 | 188 | $errHandler->registerSignalHandler(SIGURG, LogLevel::INFO, $callPrevious, false, false); |
@@ -213,7 +215,8 @@ discard block |
||
213 | 215 | $microtime = microtime(true); |
214 | 216 | |
215 | 217 | $pid = pcntl_fork(); |
216 | - if ($pid === 0) { // Child. |
|
218 | + if ($pid === 0) { |
|
219 | +// Child. |
|
217 | 220 | usleep(100000); |
218 | 221 | posix_kill($parentPid, SIGURG); |
219 | 222 | usleep(100000); |
@@ -44,7 +44,7 @@ |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
47 | - * @return Monolog\Formatter\FormatterInterface |
|
47 | + * @return Formatter\FormatterInterface |
|
48 | 48 | */ |
49 | 49 | protected function getIdentityFormatter() |
50 | 50 | { |
@@ -51,7 +51,7 @@ |
||
51 | 51 | $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface'); |
52 | 52 | $formatter->expects($this->any()) |
53 | 53 | ->method('format') |
54 | - ->will($this->returnCallback(function ($record) { return $record['message']; })); |
|
54 | + ->will($this->returnCallback(function($record){ return $record['message']; })); |
|
55 | 55 | |
56 | 56 | return $formatter; |
57 | 57 | } |