ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 More...
 
 testHandleStopsBufferingAfterTrigger ()
 Monolog::handle More...
 
 testHandleRestartBufferingAfterReset ()
 Monolog::handle Monolog::reset More...
 
 testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled ()
 Monolog::handle More...
 
 testHandleBufferLimit ()
 Monolog::handle More...
 
 testHandleWithCallback ()
 Monolog::handle More...
 
 testHandleWithBadCallbackThrowsException ()
 Monolog::handle RuntimeException More...
 
 testIsHandlingAlways ()
 Monolog::isHandling More...
 
 testErrorLevelActivationStrategy ()
 Monolog::__construct Monolog::__construct Monolog::isHandlerActivated More...
 
 testErrorLevelActivationStrategyWithPsrLevel ()
 Monolog::__construct Monolog::__construct Monolog::isHandlerActivated More...
 
 testChannelLevelActivationStrategy ()
 Monolog::__construct Monolog::isHandlerActivated More...
 
 testChannelLevelActivationStrategyWithPsrLevels ()
 Monolog::__construct Monolog::isHandlerActivated More...
 
 testHandleUsesProcessors ()
 Monolog::handle 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 180 of file FingersCrossedHandlerTest.php.

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

181  {
182  $test = new TestHandler();
183  $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy(Logger::ERROR, array('othertest' => Logger::DEBUG)));
184  $handler->handle($this->getRecord(Logger::WARNING));
185  $this->assertFalse($test->hasWarningRecords());
186  $record = $this->getRecord(Logger::DEBUG);
187  $record['channel'] = 'othertest';
188  $handler->handle($record);
189  $this->assertTrue($test->hasDebugRecords());
190  $this->assertTrue($test->hasWarningRecords());
191  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testChannelLevelActivationStrategyWithPsrLevels()

Monolog\Handler\FingersCrossedHandlerTest::testChannelLevelActivationStrategyWithPsrLevels ( )

Monolog::__construct Monolog::isHandlerActivated

Definition at line 197 of file FingersCrossedHandlerTest.php.

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

198  {
199  $test = new TestHandler();
200  $handler = new FingersCrossedHandler($test, new ChannelLevelActivationStrategy('error', array('othertest' => 'debug')));
201  $handler->handle($this->getRecord(Logger::WARNING));
202  $this->assertFalse($test->hasWarningRecords());
203  $record = $this->getRecord(Logger::DEBUG);
204  $record['channel'] = 'othertest';
205  $handler->handle($record);
206  $this->assertTrue($test->hasDebugRecords());
207  $this->assertTrue($test->hasWarningRecords());
208  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testErrorLevelActivationStrategy()

Monolog\Handler\FingersCrossedHandlerTest::testErrorLevelActivationStrategy ( )

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

Definition at line 149 of file FingersCrossedHandlerTest.php.

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

150  {
151  $test = new TestHandler();
152  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING));
153  $handler->handle($this->getRecord(Logger::DEBUG));
154  $this->assertFalse($test->hasDebugRecords());
155  $handler->handle($this->getRecord(Logger::WARNING));
156  $this->assertTrue($test->hasDebugRecords());
157  $this->assertTrue($test->hasWarningRecords());
158  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testErrorLevelActivationStrategyWithPsrLevel()

Monolog\Handler\FingersCrossedHandlerTest::testErrorLevelActivationStrategyWithPsrLevel ( )

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

Definition at line 165 of file FingersCrossedHandlerTest.php.

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

166  {
167  $test = new TestHandler();
168  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy('warning'));
169  $handler->handle($this->getRecord(Logger::DEBUG));
170  $this->assertFalse($test->hasDebugRecords());
171  $handler->handle($this->getRecord(Logger::WARNING));
172  $this->assertTrue($test->hasDebugRecords());
173  $this->assertTrue($test->hasWarningRecords());
174  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
+ Here is the call graph for this function:

◆ testHandleBufferLimit()

Monolog\Handler\FingersCrossedHandlerTest::testHandleBufferLimit ( )

Monolog::handle

Definition at line 91 of file FingersCrossedHandlerTest.php.

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

92  {
93  $test = new TestHandler();
94  $handler = new FingersCrossedHandler($test, Logger::WARNING, 2);
95  $handler->handle($this->getRecord(Logger::DEBUG));
96  $handler->handle($this->getRecord(Logger::DEBUG));
97  $handler->handle($this->getRecord(Logger::INFO));
98  $handler->handle($this->getRecord(Logger::WARNING));
99  $this->assertTrue($test->hasWarningRecords());
100  $this->assertTrue($test->hasInfoRecords());
101  $this->assertFalse($test->hasDebugRecords());
102  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

◆ testHandleBuffers()

Monolog\Handler\FingersCrossedHandlerTest::testHandleBuffers ( )

Monolog::__construct Monolog::handle

Definition at line 26 of file FingersCrossedHandlerTest.php.

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

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

◆ testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled()

Monolog\Handler\FingersCrossedHandlerTest::testHandleRestartBufferingAfterBeingTriggeredWhenStopBufferingIsDisabled ( )

Monolog::handle

Definition at line 75 of file FingersCrossedHandlerTest.php.

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

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

◆ testHandleRestartBufferingAfterReset()

Monolog\Handler\FingersCrossedHandlerTest::testHandleRestartBufferingAfterReset ( )

Monolog::handle Monolog::reset

Definition at line 58 of file FingersCrossedHandlerTest.php.

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

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

◆ testHandleStopsBufferingAfterTrigger()

Monolog\Handler\FingersCrossedHandlerTest::testHandleStopsBufferingAfterTrigger ( )

Monolog::handle

Definition at line 43 of file FingersCrossedHandlerTest.php.

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

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

◆ testHandleUsesProcessors()

Monolog\Handler\FingersCrossedHandlerTest::testHandleUsesProcessors ( )

Monolog::handle

Definition at line 213 of file FingersCrossedHandlerTest.php.

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

214  {
215  $test = new TestHandler();
216  $handler = new FingersCrossedHandler($test, Logger::INFO);
217  $handler->pushProcessor(function ($record) {
218  $record['extra']['foo'] = true;
219 
220  return $record;
221  });
222  $handler->handle($this->getRecord(Logger::WARNING));
223  $this->assertTrue($test->hasWarningRecords());
224  $records = $test->getRecords();
225  $this->assertTrue($records[0]['extra']['foo']);
226  }
$records
Definition: simple_test.php:17
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

◆ testHandleWithBadCallbackThrowsException()

Monolog\Handler\FingersCrossedHandlerTest::testHandleWithBadCallbackThrowsException ( )

Monolog::handle RuntimeException

Definition at line 126 of file FingersCrossedHandlerTest.php.

References Monolog\TestCase\getRecord(), Monolog\Handler\FingersCrossedHandler\handle(), and Monolog\Logger\WARNING.

127  {
128  $handler = new FingersCrossedHandler(function ($record, $handler) {
129  return 'foo';
130  });
131  $handler->handle($this->getRecord(Logger::WARNING));
132  }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
+ Here is the call graph for this function:

◆ testHandleWithCallback()

Monolog\Handler\FingersCrossedHandlerTest::testHandleWithCallback ( )

Monolog::handle

Definition at line 107 of file FingersCrossedHandlerTest.php.

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

108  {
109  $test = new TestHandler();
110  $handler = new FingersCrossedHandler(function ($record, $handler) use ($test) {
111  return $test;
112  });
113  $handler->handle($this->getRecord(Logger::DEBUG));
114  $handler->handle($this->getRecord(Logger::INFO));
115  $this->assertFalse($test->hasDebugRecords());
116  $this->assertFalse($test->hasInfoRecords());
117  $handler->handle($this->getRecord(Logger::WARNING));
118  $this->assertTrue($test->hasInfoRecords());
119  $this->assertTrue(count($test->getRecords()) === 3);
120  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

◆ testIsHandlingAlways()

Monolog\Handler\FingersCrossedHandlerTest::testIsHandlingAlways ( )

Monolog::isHandling

Definition at line 137 of file FingersCrossedHandlerTest.php.

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

138  {
139  $test = new TestHandler();
140  $handler = new FingersCrossedHandler($test, Logger::ERROR);
141  $this->assertTrue($handler->isHandling($this->getRecord(Logger::DEBUG)));
142  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
$test
Definition: Utf8Test.php:85

◆ testPassthruOnClose()

Monolog\Handler\FingersCrossedHandlerTest::testPassthruOnClose ( )

Monolog::close

Definition at line 231 of file FingersCrossedHandlerTest.php.

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

232  {
233  $test = new TestHandler();
234  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, Logger::INFO);
235  $handler->handle($this->getRecord(Logger::DEBUG));
236  $handler->handle($this->getRecord(Logger::INFO));
237  $handler->close();
238  $this->assertFalse($test->hasDebugRecords());
239  $this->assertTrue($test->hasInfoRecords());
240  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

◆ testPsrLevelPassthruOnClose()

Monolog\Handler\FingersCrossedHandlerTest::testPsrLevelPassthruOnClose ( )

Monolog::close

Definition at line 245 of file FingersCrossedHandlerTest.php.

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

246  {
247  $test = new TestHandler();
248  $handler = new FingersCrossedHandler($test, new ErrorLevelActivationStrategy(Logger::WARNING), 0, true, true, LogLevel::INFO);
249  $handler->handle($this->getRecord(Logger::DEBUG));
250  $handler->handle($this->getRecord(Logger::INFO));
251  $handler->close();
252  $this->assertFalse($test->hasDebugRecords());
253  $this->assertTrue($test->hasInfoRecords());
254  }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

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