ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\FingersCrossedHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\FingersCrossedHandlerTest:
+ Collaboration diagram for Monolog\Handler\FingersCrossedHandlerTest:

Public Member Functions

 testHandleBuffers ()
 Monolog::__construct Monolog::handle Monolog::activate More...
 
 testHandleStopsBufferingAfterTrigger ()
 Monolog::handle Monolog::activate More...
 
 testHandleResetBufferingAfterReset ()
 Monolog::handle Monolog::activate Monolog::reset More...
 
 testHandleResetBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled ()
 Monolog::handle Monolog::activate More...
 
 testHandleBufferLimit ()
 Monolog::handle Monolog::activate More...
 
 testHandleWithCallback ()
 Monolog::handle Monolog::activate More...
 
 testHandleWithBadCallbackThrowsException ()
 Monolog::handle Monolog::activate RuntimeException More...
 
 testIsHandlingAlways ()
 Monolog::isHandling More...
 
 testErrorLevelActivationStrategy ()
 Monolog::__construct Monolog::__construct Monolog::isHandlerActivated More...
 
 testErrorLevelActivationStrategyWithPsrLevel ()
 Monolog::__construct Monolog::__construct Monolog::isHandlerActivated More...
 
 testOverrideActivationStrategy ()
 Monolog::__construct Monolog::activate More...
 
 testChannelLevelActivationStrategy ()
 Monolog::__construct Monolog::isHandlerActivated More...
 
 testChannelLevelActivationStrategyWithPsrLevels ()
 Monolog::__construct Monolog::isHandlerActivated More...
 
 testHandleUsesProcessors ()
 Monolog::handle Monolog::activate More...
 
 testPassthruOnClose ()
 Monolog::close More...
 
 testPsrLevelPassthruOnClose ()
 Monolog::close More...
 

Additional Inherited Members

- Protected Member Functions inherited from Monolog\TestCase
 getRecord ($level=Logger::WARNING, $message='test', $context=array())
 
 getMultipleRecords ()
 
 getIdentityFormatter ()
 

Detailed Description

Definition at line 20 of file FingersCrossedHandlerTest.php.

Member Function Documentation

◆ testChannelLevelActivationStrategy()

Monolog\Handler\FingersCrossedHandlerTest::testChannelLevelActivationStrategy ( )

Monolog::__construct Monolog::isHandlerActivated

Definition at line 203 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

204  {
205  $test = new TestHandler();
206  $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG)));
207  $handler->handle($this->getRecord(Logger::WARNING));
208  $this->assertFalse($test->hasWarningRecords());
209  $record = $this->getRecord(Logger::DEBUG);
210  $record['channel'] = 'othertest';
211  $handler->handle($record);
212  $this->assertTrue($test->hasDebugRecords());
213  $this->assertTrue($test->hasWarningRecords());
214  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
const ERROR
Runtime errors.
Definition: Logger.php:58
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ testChannelLevelActivationStrategyWithPsrLevels()

Monolog\Handler\FingersCrossedHandlerTest::testChannelLevelActivationStrategyWithPsrLevels ( )

Monolog::__construct Monolog::isHandlerActivated

Definition at line 220 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

221  {
222  $test = new TestHandler();
223  $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug')));
224  $handler->handle($this->getRecord(Logger::WARNING));
225  $this->assertFalse($test->hasWarningRecords());
226  $record = $this->getRecord(Logger::DEBUG);
227  $record['channel'] = 'othertest';
228  $handler->handle($record);
229  $this->assertTrue($test->hasDebugRecords());
230  $this->assertTrue($test->hasWarningRecords());
231  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ testErrorLevelActivationStrategy()

Monolog\Handler\FingersCrossedHandlerTest::testErrorLevelActivationStrategy ( )

Monolog::__construct Monolog::__construct Monolog::isHandlerActivated

Definition at line 156 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

157  {
158  $test = new TestHandler();
159  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING));
160  $handler->handle($this->getRecord(Logger::DEBUG));
161  $this->assertFalse($test->hasDebugRecords());
162  $handler->handle($this->getRecord(Logger::WARNING));
163  $this->assertTrue($test->hasDebugRecords());
164  $this->assertTrue($test->hasWarningRecords());
165  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ testErrorLevelActivationStrategyWithPsrLevel()

Monolog\Handler\FingersCrossedHandlerTest::testErrorLevelActivationStrategyWithPsrLevel ( )

Monolog::__construct Monolog::__construct Monolog::isHandlerActivated

Definition at line 172 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

173  {
174  $test = new TestHandler();
175  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
176  $handler->handle($this->getRecord(Logger::DEBUG));
177  $this->assertFalse($test->hasDebugRecords());
178  $handler->handle($this->getRecord(Logger::WARNING));
179  $this->assertTrue($test->hasDebugRecords());
180  $this->assertTrue($test->hasWarningRecords());
181  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ testHandleBufferLimit()

Monolog\Handler\FingersCrossedHandlerTest::testHandleBufferLimit ( )

Monolog::handle Monolog::activate

Definition at line 96 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

97  {
98  $test = new TestHandler();
99  $handler = new FingersCrossedHandler($test, Logger::WARNING, 2);
100  $handler->handle($this->getRecord(Logger::DEBUG));
101  $handler->handle($this->getRecord(Logger::DEBUG));
102  $handler->handle($this->getRecord(Logger::INFO));
103  $handler->handle($this->getRecord(Logger::WARNING));
104  $this->assertTrue($test->hasWarningRecords());
105  $this->assertTrue($test->hasInfoRecords());
106  $this->assertFalse($test->hasDebugRecords());
107  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testHandleBuffers()

Monolog\Handler\FingersCrossedHandlerTest::testHandleBuffers ( )

Monolog::__construct Monolog::handle Monolog::activate

Definition at line 27 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

28  {
29  $test = new TestHandler();
30  $handler = new FingersCrossedHandler($test);
31  $handler->handle($this->getRecord(Logger::DEBUG));
32  $handler->handle($this->getRecord(Logger::INFO));
33  $this->assertFalse($test->hasDebugRecords());
34  $this->assertFalse($test->hasInfoRecords());
35  $handler->handle($this->getRecord(Logger::WARNING));
36  $handler->close();
37  $this->assertTrue($test->hasInfoRecords());
38  $this->assertTrue(count($test->getRecords()) === 3);
39  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testHandleResetBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()

Monolog\Handler\FingersCrossedHandlerTest::testHandleResetBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled ( )

Monolog::handle Monolog::activate

Definition at line 79 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

80  {
81  $test = new TestHandler();
82  $handler = new FingersCrossedHandler($test, Logger::WARNING, 0, false, false);
83  $handler->handle($this->getRecord(Logger::DEBUG));
84  $handler->handle($this->getRecord(Logger::WARNING));
85  $handler->handle($this->getRecord(Logger::INFO));
86  $handler->close();
87  $this->assertTrue($test->hasWarningRecords());
88  $this->assertTrue($test->hasDebugRecords());
89  $this->assertFalse($test->hasInfoRecords());
90  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testHandleResetBufferingAfterReset()

Monolog\Handler\FingersCrossedHandlerTest::testHandleResetBufferingAfterReset ( )

Monolog::handle Monolog::activate Monolog::reset

Definition at line 61 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

62  {
63  $test = new TestHandler();
64  $handler = new FingersCrossedHandler($test);
65  $handler->handle($this->getRecord(Logger::WARNING));
66  $handler->handle($this->getRecord(Logger::DEBUG));
67  $handler->reset();
68  $handler->handle($this->getRecord(Logger::INFO));
69  $handler->close();
70  $this->assertTrue($test->hasWarningRecords());
71  $this->assertTrue($test->hasDebugRecords());
72  $this->assertFalse($test->hasInfoRecords());
73  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testHandleStopsBufferingAfterTrigger()

Monolog\Handler\FingersCrossedHandlerTest::testHandleStopsBufferingAfterTrigger ( )

Monolog::handle Monolog::activate

Definition at line 45 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

46  {
47  $test = new TestHandler();
48  $handler = new FingersCrossedHandler($test);
49  $handler->handle($this->getRecord(Logger::WARNING));
50  $handler->handle($this->getRecord(Logger::DEBUG));
51  $handler->close();
52  $this->assertTrue($test->hasWarningRecords());
53  $this->assertTrue($test->hasDebugRecords());
54  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ testHandleUsesProcessors()

Monolog\Handler\FingersCrossedHandlerTest::testHandleUsesProcessors ( )

Monolog::handle Monolog::activate

Definition at line 237 of file FingersCrossedHandlerTest.php.

References $handler, $records, $test, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

238  {
239  $test = new TestHandler();
240  $handler = new FingersCrossedHandler($test, Logger::INFO);
241  $handler->pushProcessor(function ($record) {
242  $record['extra']['foo'] = true;
243 
244  return $record;
245  });
246  $handler->handle($this->getRecord(Logger::WARNING));
247  $this->assertTrue($test->hasWarningRecords());
248  $records = $test->getRecords();
249  $this->assertTrue($records[0]['extra']['foo']);
250  }
$records
Definition: simple_test.php:22
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testHandleWithBadCallbackThrowsException()

Monolog\Handler\FingersCrossedHandlerTest::testHandleWithBadCallbackThrowsException ( )

Monolog::handle Monolog::activate RuntimeException

Definition at line 133 of file FingersCrossedHandlerTest.php.

References $handler, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

134  {
135  $handler = new FingersCrossedHandler(function ($record, $handler) {
136  return 'foo';
137  });
138  $handler->handle($this->getRecord(Logger::WARNING));
139  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
+ Here is the call graph for this function:

◆ testHandleWithCallback()

Monolog\Handler\FingersCrossedHandlerTest::testHandleWithCallback ( )

Monolog::handle Monolog::activate

Definition at line 113 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

114  {
115  $test = new TestHandler();
116  $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) {
117  return $test;
118  });
119  $handler->handle($this->getRecord(Logger::DEBUG));
120  $handler->handle($this->getRecord(Logger::INFO));
121  $this->assertFalse($test->hasDebugRecords());
122  $this->assertFalse($test->hasInfoRecords());
123  $handler->handle($this->getRecord(Logger::WARNING));
124  $this->assertTrue($test->hasInfoRecords());
125  $this->assertTrue(count($test->getRecords()) === 3);
126  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testIsHandlingAlways()

Monolog\Handler\FingersCrossedHandlerTest::testIsHandlingAlways ( )

Monolog::isHandling

Definition at line 144 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, and Monolog\Logger\ERROR.

145  {
146  $test = new TestHandler();
147  $handler = new FingersCrossedHandler($test, Logger::ERROR);
148  $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
149  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
const ERROR
Runtime errors.
Definition: Logger.php:58
$handler
$test
Definition: Utf8Test.php:84

◆ testOverrideActivationStrategy()

Monolog\Handler\FingersCrossedHandlerTest::testOverrideActivationStrategy ( )

Monolog::__construct Monolog::activate

Definition at line 187 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\INFO.

188  {
189  $test = new TestHandler();
190  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
191  $handler->handle($this->getRecord(Logger::DEBUG));
192  $this->assertFalse($test->hasDebugRecords());
193  $handler->activate();
194  $this->assertTrue($test->hasDebugRecords());
195  $handler->handle($this->getRecord(Logger::INFO));
196  $this->assertTrue($test->hasInfoRecords());
197  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testPassthruOnClose()

Monolog\Handler\FingersCrossedHandlerTest::testPassthruOnClose ( )

Monolog::close

Definition at line 255 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Logger\INFO, and Monolog\Logger\WARNING.

256  {
257  $test = new TestHandler();
258  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO);
259  $handler->handle($this->getRecord(Logger::DEBUG));
260  $handler->handle($this->getRecord(Logger::INFO));
261  $handler->close();
262  $this->assertFalse($test->hasDebugRecords());
263  $this->assertTrue($test->hasInfoRecords());
264  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

◆ testPsrLevelPassthruOnClose()

Monolog\Handler\FingersCrossedHandlerTest::testPsrLevelPassthruOnClose ( )

Monolog::close

Definition at line 269 of file FingersCrossedHandlerTest.php.

References $handler, $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Psr\Log\LogLevel\INFO, Monolog\Logger\INFO, and Monolog\Logger\WARNING.

270  {
271  $test = new TestHandler();
272  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO);
273  $handler->handle($this->getRecord(Logger::DEBUG));
274  $handler->handle($this->getRecord(Logger::INFO));
275  $handler->close();
276  $this->assertFalse($test->hasDebugRecords());
277  $this->assertTrue($test->hasInfoRecords());
278  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
$handler
$test
Definition: Utf8Test.php:84
const INFO
Interesting events.
Definition: Logger.php:40
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: