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

Public Member Functions

 testShouldNotAcceptAnInvalidTypeOnContructor ()
 @covers Monolog\Handler\ErrorLogHandler::__construct @expectedException InvalidArgumentException @expectedExceptionMessage The given message type "42" is not supported More...
 
 testShouldLogMessagesUsingErrorLogFuncion ()
 @covers Monolog\Handler\ErrorLogHandler::write More...
 

Protected Member Functions

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

Detailed Description

Definition at line 23 of file ErrorLogHandlerTest.php.

Member Function Documentation

◆ setUp()

Monolog\Handler\ErrorLogHandlerTest::setUp ( )
protected

Definition at line 25 of file ErrorLogHandlerTest.php.

26 {
27 $GLOBALS['error_log'] = array();
28 }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS.

◆ testShouldLogMessagesUsingErrorLogFuncion()

Monolog\Handler\ErrorLogHandlerTest::testShouldLogMessagesUsingErrorLogFuncion ( )

@covers Monolog\Handler\ErrorLogHandler::write

Definition at line 43 of file ErrorLogHandlerTest.php.

44 {
46 $handler = new ErrorLogHandler($type);
47 $handler->setFormatter(new LineFormatter('%channel%.%level_name%: %message% %context% %extra%', null, true));
48 $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
49
50 $this->assertSame("test.ERROR: Foo\nBar\r\n\r\nBaz [] []", $GLOBALS['error_log'][0][0]);
51 $this->assertSame($GLOBALS['error_log'][0][1], $type);
52
53 $handler = new ErrorLogHandler($type, Logger::DEBUG, true, true);
54 $handler->setFormatter(new LineFormatter(null, null, true));
55 $handler->handle($this->getRecord(Logger::ERROR, "Foo\nBar\r\n\r\nBaz"));
56
57 $this->assertStringMatchesFormat('[%s] test.ERROR: Foo', $GLOBALS['error_log'][1][0]);
58 $this->assertSame($GLOBALS['error_log'][1][1], $type);
59
60 $this->assertStringMatchesFormat('Bar', $GLOBALS['error_log'][2][0]);
61 $this->assertSame($GLOBALS['error_log'][2][1], $type);
62
63 $this->assertStringMatchesFormat('Baz [] []', $GLOBALS['error_log'][3][0]);
64 $this->assertSame($GLOBALS['error_log'][3][1], $type);
65 }
const ERROR
Runtime errors.
Definition: Logger.php:57
const DEBUG
Detailed debug information.
Definition: Logger.php:32
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19

References $GLOBALS, Monolog\Logger\DEBUG, Monolog\Logger\ERROR, Monolog\TestCase\getRecord(), and Monolog\Handler\ErrorLogHandler\OPERATING_SYSTEM.

+ Here is the call graph for this function:

◆ testShouldNotAcceptAnInvalidTypeOnContructor()

Monolog\Handler\ErrorLogHandlerTest::testShouldNotAcceptAnInvalidTypeOnContructor ( )

@covers Monolog\Handler\ErrorLogHandler::__construct @expectedException InvalidArgumentException @expectedExceptionMessage The given message type "42" is not supported

Definition at line 35 of file ErrorLogHandlerTest.php.

36 {
37 new ErrorLogHandler(42);
38 }

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