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

Public Member Functions

 testConstructorOnlyTakesHandler ()
 @covers Monolog\Handler\WhatFailureGroupHandler::__construct @expectedException InvalidArgumentException More...
 
 testHandle ()
 @covers Monolog\Handler\WhatFailureGroupHandler::__construct @covers Monolog\Handler\WhatFailureGroupHandler::handle More...
 
 testHandleBatch ()
 @covers Monolog\Handler\WhatFailureGroupHandler::handleBatch More...
 
 testIsHandling ()
 @covers Monolog\Handler\WhatFailureGroupHandler::isHandling More...
 
 testHandleUsesProcessors ()
 @covers Monolog\Handler\WhatFailureGroupHandler::handle More...
 
 testHandleException ()
 @covers Monolog\Handler\WhatFailureGroupHandler::handle More...
 

Additional Inherited Members

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

Detailed Description

Definition at line 17 of file WhatFailureGroupHandlerTest.php.

Member Function Documentation

◆ testConstructorOnlyTakesHandler()

Monolog\Handler\WhatFailureGroupHandlerTest::testConstructorOnlyTakesHandler ( )

@covers Monolog\Handler\WhatFailureGroupHandler::__construct @expectedException InvalidArgumentException

Definition at line 23 of file WhatFailureGroupHandlerTest.php.

24 {
25 new WhatFailureGroupHandler(array(new TestHandler(), "foo"));
26 }

◆ testHandle()

Monolog\Handler\WhatFailureGroupHandlerTest::testHandle ( )

@covers Monolog\Handler\WhatFailureGroupHandler::__construct @covers Monolog\Handler\WhatFailureGroupHandler::handle

Definition at line 32 of file WhatFailureGroupHandlerTest.php.

33 {
34 $testHandlers = array(new TestHandler(), new TestHandler());
35 $handler = new WhatFailureGroupHandler($testHandlers);
36 $handler->handle($this->getRecord(Logger::DEBUG));
37 $handler->handle($this->getRecord(Logger::INFO));
38 foreach ($testHandlers as $test) {
39 $this->assertTrue($test->hasDebugRecords());
40 $this->assertTrue($test->hasInfoRecords());
41 $this->assertTrue(count($test->getRecords()) === 2);
42 }
43 }
$test
Definition: Utf8Test.php:85
const INFO
Interesting events.
Definition: Logger.php:39
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

References $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\INFO.

+ Here is the call graph for this function:

◆ testHandleBatch()

Monolog\Handler\WhatFailureGroupHandlerTest::testHandleBatch ( )

@covers Monolog\Handler\WhatFailureGroupHandler::handleBatch

Definition at line 48 of file WhatFailureGroupHandlerTest.php.

49 {
50 $testHandlers = array(new TestHandler(), new TestHandler());
51 $handler = new WhatFailureGroupHandler($testHandlers);
52 $handler->handleBatch(array($this->getRecord(Logger::DEBUG), $this->getRecord(Logger::INFO)));
53 foreach ($testHandlers as $test) {
54 $this->assertTrue($test->hasDebugRecords());
55 $this->assertTrue($test->hasInfoRecords());
56 $this->assertTrue(count($test->getRecords()) === 2);
57 }
58 }

References $test, Monolog\Logger\DEBUG, Monolog\TestCase\getRecord(), and Monolog\Logger\INFO.

+ Here is the call graph for this function:

◆ testHandleException()

Monolog\Handler\WhatFailureGroupHandlerTest::testHandleException ( )

@covers Monolog\Handler\WhatFailureGroupHandler::handle

Definition at line 93 of file WhatFailureGroupHandlerTest.php.

94 {
95 $test = new TestHandler();
96 $exception = new ExceptionTestHandler();
97 $handler = new WhatFailureGroupHandler(array($exception, $test, $exception));
98 $handler->pushProcessor(function ($record) {
99 $record['extra']['foo'] = true;
100
101 return $record;
102 });
103 $handler->handle($this->getRecord(Logger::WARNING));
104 $this->assertTrue($test->hasWarningRecords());
105 $records = $test->getRecords();
106 $this->assertTrue($records[0]['extra']['foo']);
107 }
const WARNING
Exceptional occurrences that are not errors.
Definition: Logger.php:52
$records
Definition: simple_test.php:17

References $records, $test, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

◆ testHandleUsesProcessors()

Monolog\Handler\WhatFailureGroupHandlerTest::testHandleUsesProcessors ( )

@covers Monolog\Handler\WhatFailureGroupHandler::handle

Definition at line 75 of file WhatFailureGroupHandlerTest.php.

76 {
77 $test = new TestHandler();
78 $handler = new WhatFailureGroupHandler(array($test));
79 $handler->pushProcessor(function ($record) {
80 $record['extra']['foo'] = true;
81
82 return $record;
83 });
84 $handler->handle($this->getRecord(Logger::WARNING));
85 $this->assertTrue($test->hasWarningRecords());
86 $records = $test->getRecords();
87 $this->assertTrue($records[0]['extra']['foo']);
88 }

References $records, $test, Monolog\TestCase\getRecord(), and Monolog\Logger\WARNING.

+ Here is the call graph for this function:

◆ testIsHandling()

Monolog\Handler\WhatFailureGroupHandlerTest::testIsHandling ( )

@covers Monolog\Handler\WhatFailureGroupHandler::isHandling

Definition at line 63 of file WhatFailureGroupHandlerTest.php.

64 {
65 $testHandlers = array(new TestHandler(Logger::ERROR), new TestHandler(Logger::WARNING));
66 $handler = new WhatFailureGroupHandler($testHandlers);
67 $this->assertTrue($handler->isHandling($this->getRecord(Logger::ERROR)));
68 $this->assertTrue($handler->isHandling($this->getRecord(Logger::WARNING)));
69 $this->assertFalse($handler->isHandling($this->getRecord(Logger::DEBUG)));
70 }
const ERROR
Runtime errors.
Definition: Logger.php:57

References Monolog\Logger\DEBUG, Monolog\Logger\ERROR, and Monolog\Logger\WARNING.


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