ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Monolog\Handler\ChromePHPHandlerTest Class Reference

@covers Monolog\Handler\ChromePHPHandler More...

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

Public Member Functions

 testHeaders ()
 
 testHeadersOverflow ()
 
 testConcurrentHandlers ()
 

Protected Member Functions

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

Detailed Description

@covers Monolog\Handler\ChromePHPHandler

Definition at line 20 of file ChromePHPHandlerTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\ChromePHPHandlerTest::setUp ( )
protected

Definition at line 22 of file ChromePHPHandlerTest.php.

23 {
25 $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; Chrome/1.0';
26 }
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, and Monolog\Handler\TestChromePHPHandler\reset().

+ Here is the call graph for this function:

◆ testConcurrentHandlers()

Monolog\Handler\ChromePHPHandlerTest::testConcurrentHandlers ( )

Definition at line 90 of file ChromePHPHandlerTest.php.

91 {
92 $handler = new TestChromePHPHandler();
93 $handler->setFormatter($this->getIdentityFormatter());
94 $handler->handle($this->getRecord(Logger::DEBUG));
95 $handler->handle($this->getRecord(Logger::WARNING));
96
97 $handler2 = new TestChromePHPHandler();
98 $handler2->setFormatter($this->getIdentityFormatter());
99 $handler2->handle($this->getRecord(Logger::DEBUG));
100 $handler2->handle($this->getRecord(Logger::WARNING));
101
102 $expected = array(
103 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
104 'version' => ChromePHPHandler::VERSION,
105 'columns' => array('label', 'log', 'backtrace', 'type'),
106 'rows' => array(
107 'test',
108 'test',
109 'test',
110 'test',
111 ),
112 'request_uri' => '',
113 ))))
114 );
115
116 $this->assertEquals($expected, $handler2->getHeaders());
117 }
const VERSION
Version of the extension.
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

References Monolog\Logger\DEBUG, Monolog\TestCase\getIdentityFormatter(), Monolog\TestCase\getRecord(), Monolog\Handler\ChromePHPHandler\VERSION, and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

◆ testHeaders()

Monolog\Handler\ChromePHPHandlerTest::testHeaders ( )

Definition at line 28 of file ChromePHPHandlerTest.php.

29 {
30 $handler = new TestChromePHPHandler();
31 $handler->setFormatter($this->getIdentityFormatter());
32 $handler->handle($this->getRecord(Logger::DEBUG));
33 $handler->handle($this->getRecord(Logger::WARNING));
34
35 $expected = array(
36 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
37 'version' => ChromePHPHandler::VERSION,
38 'columns' => array('label', 'log', 'backtrace', 'type'),
39 'rows' => array(
40 'test',
41 'test',
42 ),
43 'request_uri' => '',
44 ))))
45 );
46
47 $this->assertEquals($expected, $handler->getHeaders());
48 }

References Monolog\Logger\DEBUG, Monolog\TestCase\getIdentityFormatter(), Monolog\TestCase\getRecord(), Monolog\Handler\ChromePHPHandler\VERSION, and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

◆ testHeadersOverflow()

Monolog\Handler\ChromePHPHandlerTest::testHeadersOverflow ( )

Definition at line 50 of file ChromePHPHandlerTest.php.

51 {
52 $handler = new TestChromePHPHandler();
53 $handler->handle($this->getRecord(Logger::DEBUG));
54 $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150*1024)));
55
56 // overflow chrome headers limit
57 $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100*1024)));
58
59 $expected = array(
60 'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
61 'version' => ChromePHPHandler::VERSION,
62 'columns' => array('label', 'log', 'backtrace', 'type'),
63 'rows' => array(
64 array(
65 'test',
66 'test',
67 'unknown',
68 'log',
69 ),
70 array(
71 'test',
72 str_repeat('a', 150*1024),
73 'unknown',
74 'warn',
75 ),
76 array(
77 'monolog',
78 'Incomplete logs, chrome header size limit reached',
79 'unknown',
80 'warn',
81 ),
82 ),
83 'request_uri' => '',
84 ))))
85 );
86
87 $this->assertEquals($expected, $handler->getHeaders());
88 }

References Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), Monolog\Handler\ChromePHPHandler\VERSION, and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

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