ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
FirePHPHandlerTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the Monolog package.
5  *
6  * (c) Jordi Boggiano <j.boggiano@seld.be>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11 
12 namespace Monolog\Handler;
13 
15 use Monolog\Logger;
16 
21 {
22  public function setUp()
23  {
25  $_SERVER['HTTP_USER_AGENT'] = 'Monolog Test; FirePHP/1.0';
26  }
27 
28  public function testHeaders()
29  {
30  $handler = new TestFirePHPHandler;
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-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
37  'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
38  'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
39  'X-Wf-1-1-1-1' => 'test',
40  'X-Wf-1-1-1-2' => 'test',
41  );
42 
43  $this->assertEquals($expected, $handler->getHeaders());
44  }
45 
46  public function testConcurrentHandlers()
47  {
48  $handler = new TestFirePHPHandler;
49  $handler->setFormatter($this->getIdentityFormatter());
50  $handler->handle($this->getRecord(Logger::DEBUG));
51  $handler->handle($this->getRecord(Logger::WARNING));
52 
53  $handler2 = new TestFirePHPHandler;
54  $handler2->setFormatter($this->getIdentityFormatter());
55  $handler2->handle($this->getRecord(Logger::DEBUG));
56  $handler2->handle($this->getRecord(Logger::WARNING));
57 
58  $expected = array(
59  'X-Wf-Protocol-1' => 'http://meta.wildfirehq.org/Protocol/JsonStream/0.2',
60  'X-Wf-1-Structure-1' => 'http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1',
61  'X-Wf-1-Plugin-1' => 'http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3',
62  'X-Wf-1-1-1-1' => 'test',
63  'X-Wf-1-1-1-2' => 'test',
64  );
65 
66  $expected2 = array(
67  'X-Wf-1-1-1-3' => 'test',
68  'X-Wf-1-1-1-4' => 'test',
69  );
70 
71  $this->assertEquals($expected, $handler->getHeaders());
72  $this->assertEquals($expected2, $handler2->getHeaders());
73  }
74 }
75 
77 {
78  protected $headers = array();
79 
80  public static function reset()
81  {
82  self::$initialized = false;
83  self::$sendHeaders = true;
84  self::$messageIndex = 1;
85  }
86 
87  protected function sendHeader($header, $content)
88  {
89  $this->headers[$header] = $content;
90  }
91 
92  public function getHeaders()
93  {
94  return $this->headers;
95  }
96 }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol.
setFormatter(FormatterInterface $formatter)
{Sets the formatter.self}
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$header
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
Create styles array
The data for the language used.