ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Handler\ErrorLogHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\ErrorLogHandlerTest:
+ Collaboration diagram for Monolog\Handler\ErrorLogHandlerTest:

Public Member Functions

 testShouldNotAcceptAnInvalidTypeOnContructor ()
 Monolog::__construct InvalidArgumentException The given message type "42" is not supported More...
 
 testShouldLogMessagesUsingErrorLogFuncion ()
 Monolog::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.

References $GLOBALS, and array.

26  {
27  $GLOBALS['error_log'] = array();
28  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.

◆ testShouldLogMessagesUsingErrorLogFuncion()

Monolog\Handler\ErrorLogHandlerTest::testShouldLogMessagesUsingErrorLogFuncion ( )

Monolog::write

Definition at line 43 of file ErrorLogHandlerTest.php.

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

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 DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
$type
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$handler
+ Here is the call graph for this function:

◆ testShouldNotAcceptAnInvalidTypeOnContructor()

Monolog\Handler\ErrorLogHandlerTest::testShouldNotAcceptAnInvalidTypeOnContructor ( )

Monolog::__construct InvalidArgumentException 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: