ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Formatter\ChromePHPFormatterTest Class Reference
+ Inheritance diagram for Monolog\Formatter\ChromePHPFormatterTest:
+ Collaboration diagram for Monolog\Formatter\ChromePHPFormatterTest:

Public Member Functions

 testDefaultFormat ()
 @covers Monolog\Formatter\ChromePHPFormatter::format More...
 
 testFormatWithFileAndLine ()
 @covers Monolog\Formatter\ChromePHPFormatter::format More...
 
 testFormatWithoutContext ()
 @covers Monolog\Formatter\ChromePHPFormatter::format More...
 
 testBatchFormatThrowException ()
 @covers Monolog\Formatter\ChromePHPFormatter::formatBatch More...
 

Detailed Description

Definition at line 16 of file ChromePHPFormatterTest.php.

Member Function Documentation

◆ testBatchFormatThrowException()

Monolog\Formatter\ChromePHPFormatterTest::testBatchFormatThrowException ( )

@covers Monolog\Formatter\ChromePHPFormatter::formatBatch

Definition at line 116 of file ChromePHPFormatterTest.php.

117 {
118 $formatter = new ChromePHPFormatter();
119 $records = array(
120 array(
121 'level' => Logger::INFO,
122 'level_name' => 'INFO',
123 'channel' => 'meh',
124 'context' => array(),
125 'datetime' => new \DateTime("@0"),
126 'extra' => array(),
127 'message' => 'log',
128 ),
129 array(
130 'level' => Logger::WARNING,
131 'level_name' => 'WARNING',
132 'channel' => 'foo',
133 'context' => array(),
134 'datetime' => new \DateTime("@0"),
135 'extra' => array(),
136 'message' => 'log2',
137 ),
138 );
139
140 $this->assertEquals(
141 array(
142 array(
143 'meh',
144 'log',
145 'unknown',
146 'info'
147 ),
148 array(
149 'foo',
150 'log2',
151 'unknown',
152 'warn'
153 ),
154 ),
155 $formatter->formatBatch($records)
156 );
157 }
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
const INFO
Interesting events.
Definition: Logger.php:39
$records
Definition: simple_test.php:17

References $records, Monolog\Logger\INFO, and Monolog\Logger\WARNING.

◆ testDefaultFormat()

Monolog\Formatter\ChromePHPFormatterTest::testDefaultFormat ( )

@covers Monolog\Formatter\ChromePHPFormatter::format

Definition at line 21 of file ChromePHPFormatterTest.php.

22 {
23 $formatter = new ChromePHPFormatter();
24 $record = array(
25 'level' => Logger::ERROR,
26 'level_name' => 'ERROR',
27 'channel' => 'meh',
28 'context' => array('from' => 'logger'),
29 'datetime' => new \DateTime("@0"),
30 'extra' => array('ip' => '127.0.0.1'),
31 'message' => 'log',
32 );
33
34 $message = $formatter->format($record);
35
36 $this->assertEquals(
37 array(
38 'meh',
39 array(
40 'message' => 'log',
41 'context' => array('from' => 'logger'),
42 'extra' => array('ip' => '127.0.0.1'),
43 ),
44 'unknown',
45 'error'
46 ),
47 $message
48 );
49 }
const ERROR
Runtime errors.
Definition: Logger.php:57

References Monolog\Logger\ERROR.

◆ testFormatWithFileAndLine()

Monolog\Formatter\ChromePHPFormatterTest::testFormatWithFileAndLine ( )

@covers Monolog\Formatter\ChromePHPFormatter::format

Definition at line 54 of file ChromePHPFormatterTest.php.

55 {
56 $formatter = new ChromePHPFormatter();
57 $record = array(
58 'level' => Logger::CRITICAL,
59 'level_name' => 'CRITICAL',
60 'channel' => 'meh',
61 'context' => array('from' => 'logger'),
62 'datetime' => new \DateTime("@0"),
63 'extra' => array('ip' => '127.0.0.1', 'file' => 'test', 'line' => 14),
64 'message' => 'log',
65 );
66
67 $message = $formatter->format($record);
68
69 $this->assertEquals(
70 array(
71 'meh',
72 array(
73 'message' => 'log',
74 'context' => array('from' => 'logger'),
75 'extra' => array('ip' => '127.0.0.1'),
76 ),
77 'test : 14',
78 'error'
79 ),
80 $message
81 );
82 }
const CRITICAL
Critical conditions.
Definition: Logger.php:64

References Monolog\Logger\CRITICAL.

◆ testFormatWithoutContext()

Monolog\Formatter\ChromePHPFormatterTest::testFormatWithoutContext ( )

@covers Monolog\Formatter\ChromePHPFormatter::format

Definition at line 87 of file ChromePHPFormatterTest.php.

88 {
89 $formatter = new ChromePHPFormatter();
90 $record = array(
91 'level' => Logger::DEBUG,
92 'level_name' => 'DEBUG',
93 'channel' => 'meh',
94 'context' => array(),
95 'datetime' => new \DateTime("@0"),
96 'extra' => array(),
97 'message' => 'log',
98 );
99
100 $message = $formatter->format($record);
101
102 $this->assertEquals(
103 array(
104 'meh',
105 'log',
106 'unknown',
107 'log'
108 ),
109 $message
110 );
111 }
const DEBUG
Detailed debug information.
Definition: Logger.php:32

References Monolog\Logger\DEBUG.


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