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

Monolog More...

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

Public Member Functions

 testHeaders ($agent)
 agentsProvider More...
 
 testHeadersOverflow ()
 
 testConcurrentHandlers ()
 

Static Public Member Functions

static agentsProvider ()
 

Protected Member Functions

 setUp ()
 
- 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 ChromePHPHandlerTest.php.

Member Function Documentation

◆ agentsProvider()

static Monolog\Handler\ChromePHPHandlerTest::agentsProvider ( )
static

Definition at line 55 of file ChromePHPHandlerTest.php.

56  {
57  return array(
58  array('Monolog Test; Chrome/1.0'),
59  array('Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0'),
60  array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/56.0.2924.76 Chrome/56.0.2924.76 Safari/537.36'),
61  array('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome Safari/537.36'),
62  );
63  }

◆ setUp()

Monolog\Handler\ChromePHPHandlerTest::setUp ( )
protected

Definition at line 22 of file ChromePHPHandlerTest.php.

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

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']
+ Here is the call graph for this function:

◆ testConcurrentHandlers()

Monolog\Handler\ChromePHPHandlerTest::testConcurrentHandlers ( )

Definition at line 105 of file ChromePHPHandlerTest.php.

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

106  {
107  $handler = new TestChromePHPHandler();
108  $handler->setFormatter($this->getIdentityFormatter());
109  $handler->handle($this->getRecord(Logger::DEBUG));
110  $handler->handle($this->getRecord(Logger::WARNING));
111 
112  $handler2 = new TestChromePHPHandler();
113  $handler2->setFormatter($this->getIdentityFormatter());
114  $handler2->handle($this->getRecord(Logger::DEBUG));
115  $handler2->handle($this->getRecord(Logger::WARNING));
116 
117  $expected = array(
118  'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
119  'version' => ChromePHPHandler::VERSION,
120  'columns' => array('label', 'log', 'backtrace', 'type'),
121  'rows' => array(
122  'test',
123  'test',
124  'test',
125  'test',
126  ),
127  'request_uri' => '',
128  )))),
129  );
130 
131  $this->assertEquals($expected, $handler2->getHeaders());
132  }
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
const VERSION
Version of the extension.
+ Here is the call graph for this function:

◆ testHeaders()

Monolog\Handler\ChromePHPHandlerTest::testHeaders (   $agent)

agentsProvider

Definition at line 31 of file ChromePHPHandlerTest.php.

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

32  {
33  $_SERVER['HTTP_USER_AGENT'] = $agent;
34 
35  $handler = new TestChromePHPHandler();
36  $handler->setFormatter($this->getIdentityFormatter());
37  $handler->handle($this->getRecord(Logger::DEBUG));
38  $handler->handle($this->getRecord(Logger::WARNING));
39 
40  $expected = array(
41  'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
42  'version' => ChromePHPHandler::VERSION,
43  'columns' => array('label', 'log', 'backtrace', 'type'),
44  'rows' => array(
45  'test',
46  'test',
47  ),
48  'request_uri' => '',
49  )))),
50  );
51 
52  $this->assertEquals($expected, $handler->getHeaders());
53  }
const DEBUG
Detailed debug information.
Definition: Logger.php:33
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
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
const VERSION
Version of the extension.
+ Here is the call graph for this function:

◆ testHeadersOverflow()

Monolog\Handler\ChromePHPHandlerTest::testHeadersOverflow ( )

Definition at line 65 of file ChromePHPHandlerTest.php.

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

66  {
67  $handler = new TestChromePHPHandler();
68  $handler->handle($this->getRecord(Logger::DEBUG));
69  $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 150 * 1024)));
70 
71  // overflow chrome headers limit
72  $handler->handle($this->getRecord(Logger::WARNING, str_repeat('a', 100 * 1024)));
73 
74  $expected = array(
75  'X-ChromeLogger-Data' => base64_encode(utf8_encode(json_encode(array(
76  'version' => ChromePHPHandler::VERSION,
77  'columns' => array('label', 'log', 'backtrace', 'type'),
78  'rows' => array(
79  array(
80  'test',
81  'test',
82  'unknown',
83  'log',
84  ),
85  array(
86  'test',
87  str_repeat('a', 150 * 1024),
88  'unknown',
89  'warn',
90  ),
91  array(
92  'monolog',
93  'Incomplete logs, chrome header size limit reached',
94  'unknown',
95  'warn',
96  ),
97  ),
98  'request_uri' => '',
99  )))),
100  );
101 
102  $this->assertEquals($expected, $handler->getHeaders());
103  }
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
const VERSION
Version of the extension.
+ Here is the call graph for this function:

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