ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
AbstractProcessingHandlerTest.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;
17 
19 {
23  public function testHandleLowerLevelMessage()
24  {
25  $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, true));
26  $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
27  }
28 
32  public function testHandleBubbling()
33  {
34  $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, true));
35  $this->assertFalse($handler->handle($this->getRecord()));
36  }
37 
41  public function testHandleNotBubbling()
42  {
43  $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::DEBUG, false));
44  $this->assertTrue($handler->handle($this->getRecord()));
45  }
46 
51  {
52  $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler', array(Logger::WARNING, false));
53  $this->assertTrue($handler->handle($this->getRecord()));
54  $this->assertFalse($handler->handle($this->getRecord(Logger::DEBUG)));
55  }
56 
60  public function testProcessRecord()
61  {
62  $handler = $this->getMockForAbstractClass('Monolog\Handler\AbstractProcessingHandler');
63  $handler->pushProcessor(new WebProcessor(array(
64  'REQUEST_URI' => '',
65  'REQUEST_METHOD' => '',
66  'REMOTE_ADDR' => '',
67  'SERVER_NAME' => '',
68  'UNIQUE_ID' => '',
69  )));
70  $handledRecord = null;
71  $handler->expects($this->once())
72  ->method('write')
73  ->will($this->returnCallback(function ($record) use (&$handledRecord) {
74  $handledRecord = $record;
75  }))
76  ;
77  $handler->handle($this->getRecord());
78  $this->assertEquals(6, count($handledRecord['extra']));
79  }
80 }
const DEBUG
Detailed debug information.
Definition: Logger.php:32
Injects url/method and remote IP of the current web request in all records.
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
Create styles array
The data for the language used.