ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
Monolog\Handler\MailHandlerTest Class Reference
+ Inheritance diagram for Monolog\Handler\MailHandlerTest:
+ Collaboration diagram for Monolog\Handler\MailHandlerTest:

Public Member Functions

 testHandleBatch ()
 Monolog::handleBatch More...
 
 testHandleBatchNotSendsMailIfMessagesAreBelowLevel ()
 Monolog::handleBatch More...
 
 testHandle ()
 Monolog::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 ( )

Monolog::write

Definition at line 61 of file MailHandlerTest.php.

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

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  }
$records
Definition: simple_test.php:22
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ testHandleBatch()

Monolog\Handler\MailHandlerTest::testHandleBatch ( )

Monolog::handleBatch

Definition at line 22 of file MailHandlerTest.php.

References Monolog\TestCase\getMultipleRecords().

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  }
+ Here is the call graph for this function:

◆ testHandleBatchNotSendsMailIfMessagesAreBelowLevel()

Monolog\Handler\MailHandlerTest::testHandleBatchNotSendsMailIfMessagesAreBelowLevel ( )

Monolog::handleBatch

Definition at line 42 of file MailHandlerTest.php.

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

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 DEBUG
Detailed debug information.
Definition: Logger.php:32
const ERROR
Runtime errors.
Definition: Logger.php:57
$records
Definition: simple_test.php:22
getRecord($level=Logger::WARNING, $message='test', $context=array())
Definition: TestCase.php:19
Create styles array
The data for the language used.
const INFO
Interesting events.
Definition: Logger.php:39
+ Here is the call graph for this function:

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