@@ -25,18 +25,18 @@ discard block |
||
25 | 25 | */ |
26 | 26 | protected function setUp() |
27 | 27 | { |
28 | - if( class_exists( '\\Neos\\Flow\\Log\\Logger' ) === false ) { |
|
29 | - $this->markTestSkipped( 'Class \\Neos\\Flow\\Log\\Logger not found' ); |
|
28 | + if (class_exists('\\Neos\\Flow\\Log\\Logger') === false) { |
|
29 | + $this->markTestSkipped('Class \\Neos\\Flow\\Log\\Logger not found'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $be = new \Neos\Flow\Log\Backend\FileBackend(); |
33 | - $be->setSeverityThreshold( LOG_ERR ); |
|
34 | - $be->setLogFileURL( 'flow.log' ); |
|
33 | + $be->setSeverityThreshold(LOG_ERR); |
|
34 | + $be->setLogFileURL('flow.log'); |
|
35 | 35 | |
36 | 36 | $log = new \Neos\Flow\Log\Logger(); |
37 | - $log->addBackend( $be ); |
|
37 | + $log->addBackend($be); |
|
38 | 38 | |
39 | - $this->object = new \Aimeos\MW\Logger\Flow( $log ); |
|
39 | + $this->object = new \Aimeos\MW\Logger\Flow($log); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -48,53 +48,53 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function tearDown() |
50 | 50 | { |
51 | - @unlink( 'flow.log' ); |
|
51 | + @unlink('flow.log'); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | |
55 | 55 | public function testLog() |
56 | 56 | { |
57 | - $this->object->log( 'error' ); |
|
58 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents( 'flow.log' ) ); |
|
57 | + $this->object->log('error'); |
|
58 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+error/', file_get_contents('flow.log')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
62 | 62 | public function testNonScalarLog() |
63 | 63 | { |
64 | - $this->object->log( array( 'error', 'error2', 2 ) ); |
|
65 | - $this->assertRegExp( '/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents( 'flow.log' ) ); |
|
64 | + $this->object->log(array('error', 'error2', 2)); |
|
65 | + $this->assertRegExp('/^[^ ]+ [^ ]+ [0-9]+[ ]+ERROR[ ]+MW[ ]+\["error","error2",2\]/', file_get_contents('flow.log')); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | |
69 | 69 | public function testLogDebug() |
70 | 70 | { |
71 | - $this->object->log( 'debug', \Aimeos\MW\Logger\Base::DEBUG ); |
|
72 | - $this->assertEquals( '', file_get_contents( 'flow.log' ) ); |
|
71 | + $this->object->log('debug', \Aimeos\MW\Logger\Base::DEBUG); |
|
72 | + $this->assertEquals('', file_get_contents('flow.log')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
76 | 76 | public function testBadPriority() |
77 | 77 | { |
78 | - $this->setExpectedException( '\\Aimeos\\MW\\Logger\\Exception' ); |
|
79 | - $this->object->log( 'error', -1 ); |
|
78 | + $this->setExpectedException('\\Aimeos\\MW\\Logger\\Exception'); |
|
79 | + $this->object->log('error', -1); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | 83 | public function testLogPriorityTranslate() |
84 | 84 | { |
85 | - $this->object->log( '', \Aimeos\MW\Logger\Base::EMERG ); |
|
86 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ALERT ); |
|
87 | - $this->object->log( '', \Aimeos\MW\Logger\Base::CRIT ); |
|
88 | - $this->object->log( '', \Aimeos\MW\Logger\Base::ERR ); |
|
89 | - $this->object->log( '', \Aimeos\MW\Logger\Base::WARN ); |
|
90 | - $this->object->log( '', \Aimeos\MW\Logger\Base::NOTICE ); |
|
91 | - $this->object->log( '', \Aimeos\MW\Logger\Base::INFO ); |
|
92 | - $this->object->log( '', \Aimeos\MW\Logger\Base::DEBUG ); |
|
93 | - |
|
94 | - $content = file_get_contents( 'flow.log' ); |
|
95 | - $this->assertContains( 'EMERGENCY', $content ); |
|
96 | - $this->assertContains( 'ALERT', $content ); |
|
97 | - $this->assertContains( 'CRITICAL', $content ); |
|
98 | - $this->assertContains( 'ERROR', $content ); |
|
85 | + $this->object->log('', \Aimeos\MW\Logger\Base::EMERG); |
|
86 | + $this->object->log('', \Aimeos\MW\Logger\Base::ALERT); |
|
87 | + $this->object->log('', \Aimeos\MW\Logger\Base::CRIT); |
|
88 | + $this->object->log('', \Aimeos\MW\Logger\Base::ERR); |
|
89 | + $this->object->log('', \Aimeos\MW\Logger\Base::WARN); |
|
90 | + $this->object->log('', \Aimeos\MW\Logger\Base::NOTICE); |
|
91 | + $this->object->log('', \Aimeos\MW\Logger\Base::INFO); |
|
92 | + $this->object->log('', \Aimeos\MW\Logger\Base::DEBUG); |
|
93 | + |
|
94 | + $content = file_get_contents('flow.log'); |
|
95 | + $this->assertContains('EMERGENCY', $content); |
|
96 | + $this->assertContains('ALERT', $content); |
|
97 | + $this->assertContains('CRITICAL', $content); |
|
98 | + $this->assertContains('ERROR', $content); |
|
99 | 99 | } |
100 | 100 | } |