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

Public Member Functions

 testHandleBatch ()
 @covers Monolog\Handler\MailHandler::handleBatch More...
 
 testHandleBatchNotSendsMailIfMessagesAreBelowLevel ()
 @covers Monolog\Handler\MailHandler::handleBatch More...
 
 testHandle ()
 @covers Monolog\Handler\MailHandler::write 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 MailHandlerTest.php.

Member Function Documentation

◆ testHandle()

Monolog\Handler\MailHandlerTest::testHandle ( )

@covers Monolog\Handler\MailHandler::write

Definition at line 61 of file MailHandlerTest.php.

62 {
63 $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
64
65 $record = $this->getRecord();
66 $records = array($record);
67 $records[0]['formatted'] = '['.$record['datetime']->format('Y-m-d H:i:s').'] test.WARNING: test [] []'."\n";
68
69 $handler->expects($this->once())
70 ->method('send')
71 ->with($records[0]['formatted'], $records);
72
73 $handler->handle($record);
74 }
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
$records
Definition: simple_test.php:17

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

+ Here is the call graph for this function:

◆ testHandleBatch()

Monolog\Handler\MailHandlerTest::testHandleBatch ( )

@covers Monolog\Handler\MailHandler::handleBatch

Definition at line 22 of file MailHandlerTest.php.

23 {
24 $formatter = $this->getMock('Monolog\\Formatter\\FormatterInterface');
25 $formatter->expects($this->once())
26 ->method('formatBatch'); // Each record is formatted
27
28 $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
29 $handler->expects($this->once())
30 ->method('send');
31 $handler->expects($this->never())
32 ->method('write'); // write is for individual records
33
34 $handler->setFormatter($formatter);
35
36 $handler->handleBatch($this->getMultipleRecords());
37 }

References Monolog\TestCase\getMultipleRecords().

+ Here is the call graph for this function:

◆ testHandleBatchNotSendsMailIfMessagesAreBelowLevel()

Monolog\Handler\MailHandlerTest::testHandleBatchNotSendsMailIfMessagesAreBelowLevel ( )

@covers Monolog\Handler\MailHandler::handleBatch

Definition at line 42 of file MailHandlerTest.php.

43 {
44 $records = array(
45 $this->getRecord(Logger::DEBUG, 'debug message 1'),
46 $this->getRecord(Logger::DEBUG, 'debug message 2'),
47 $this->getRecord(Logger::INFO, 'information'),
48 );
49
50 $handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
51 $handler->expects($this->never())
52 ->method('send');
53 $handler->setLevel(Logger::ERROR);
54
55 $handler->handleBatch($records);
56 }
const ERROR
Runtime errors.
Definition: Logger.php:57
const INFO
Interesting events.
Definition: Logger.php:39
const DEBUG
Detailed debug information.
Definition: Logger.php:32

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

+ Here is the call graph for this function:

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