ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Monolog\Handler\TestHandlerTest Class Reference

Monolog More...

+ Inheritance diagram for Monolog\Handler\TestHandlerTest:
+ Collaboration diagram for Monolog\Handler\TestHandlerTest:

Public Member Functions

 testHandler ($method, $level)
 methodProvider More...
 
 testHandlerAssertEmptyContext ()
 
 testHandlerAssertNonEmptyContext ()
 
 methodProvider ()
 

Additional Inherited Members

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

Detailed Description

Monolog

Definition at line 20 of file TestHandlerTest.php.

Member Function Documentation

◆ methodProvider()

Monolog\Handler\TestHandlerTest::methodProvider ( )

Definition at line 103 of file TestHandlerTest.php.

References DEBUG.

104  {
105  return array(
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),
114  );
115  }
const NOTICE
Uncommon events.
Definition: Logger.php:45
const DEBUG
Detailed debug information.
Definition: Logger.php:33
const ERROR
Runtime errors.
Definition: Logger.php:58
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:53
const EMERGENCY
Urgent alert.
Definition: Logger.php:78
const CRITICAL
Critical conditions.
Definition: Logger.php:65
const ALERT
Action must be taken immediately.
Definition: Logger.php:73
const INFO
Interesting events.
Definition: Logger.php:40

◆ testHandler()

Monolog\Handler\TestHandlerTest::testHandler (   $method,
  $level 
)

methodProvider

Definition at line 25 of file TestHandlerTest.php.

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

26  {
27  $handler = new TestHandler;
28  $record = $this->getRecord($level, 'test'.$method);
29  $this->assertFalse($handler->hasRecords($level));
30  $this->assertFalse($handler->hasRecord($record, $level));
31  $this->assertFalse($handler->{'has'.$method}($record), 'has'.$method);
32  $this->assertFalse($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
33  $this->assertFalse($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
34  return true;
35  }), 'has'.$method.'ThatPasses');
36  $this->assertFalse($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));
37  $this->assertFalse($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records');
38  $handler->handle($record);
39 
40  $this->assertFalse($handler->{'has'.$method}('bar'), 'has'.$method);
41  $this->assertTrue($handler->hasRecords($level));
42  $this->assertTrue($handler->hasRecord($record, $level));
43  $this->assertTrue($handler->{'has'.$method}($record), 'has'.$method);
44  $this->assertTrue($handler->{'has'.$method}('test'.$method), 'has'.$method);
45  $this->assertTrue($handler->{'has'.$method.'ThatContains'}('test'), 'has'.$method.'ThatContains');
46  $this->assertTrue($handler->{'has'.$method.'ThatPasses'}(function ($rec) {
47  return true;
48  }), 'has'.$method.'ThatPasses');
49  $this->assertTrue($handler->{'has'.$method.'ThatMatches'}('/test\w+/'));
50  $this->assertTrue($handler->{'has'.$method.'Records'}(), 'has'.$method.'Records');
51 
52  $records = $handler->getRecords();
53  unset($records[0]['formatted']);
54  $this->assertEquals(array($record), $records);
55  }
$records
Definition: simple_test.php:22
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testHandlerAssertEmptyContext()

Monolog\Handler\TestHandlerTest::testHandlerAssertEmptyContext ( )

Definition at line 57 of file TestHandlerTest.php.

References $handler.

57  {
58  $handler = new TestHandler;
59  $record = $this->getRecord(Logger::WARNING, 'test', array());
60  $this->assertFalse($handler->hasWarning(array(
61  'message' => 'test',
62  'context' => array(),
63  )));
64 
65  $handler->handle($record);
66 
67  $this->assertTrue($handler->hasWarning(array(
68  'message' => 'test',
69  'context' => array(),
70  )));
71  $this->assertFalse($handler->hasWarning(array(
72  'message' => 'test',
73  'context' => array(
74  'foo' => 'bar'
75  ),
76  )));
77  }
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

◆ testHandlerAssertNonEmptyContext()

Monolog\Handler\TestHandlerTest::testHandlerAssertNonEmptyContext ( )

Definition at line 79 of file TestHandlerTest.php.

References $handler.

79  {
80  $handler = new TestHandler;
81  $record = $this->getRecord(Logger::WARNING, 'test', array('foo' => 'bar'));
82  $this->assertFalse($handler->hasWarning(array(
83  'message' => 'test',
84  'context' => array(
85  'foo' => 'bar'
86  ),
87  )));
88 
89  $handler->handle($record);
90 
91  $this->assertTrue($handler->hasWarning(array(
92  'message' => 'test',
93  'context' => array(
94  'foo' => 'bar'
95  ),
96  )));
97  $this->assertFalse($handler->hasWarning(array(
98  'message' => 'test',
99  'context' => array(),
100  )));
101  }
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

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