1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-15 21:56:16 +02:00
Files
php-monolog/tests/Monolog/Handler/MailHandlerTest.php
2011-04-22 17:41:10 +02:00

42 lines
1.1 KiB
PHP

<?php
namespace Monolog\Handler;
use Monolog\Logger;
use Monolog\TestCase;
class MailHandlerTest extends TestCase
{
public function testHandleBatch()
{
$records = $this->getMultipleRecords();
$formatter = $this->getMock('Monolog\Formatter\LineFormatter');
$formatter->expects($this->exactly(count($records)))
->method('format'); // Each record is formatted
$handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
$handler->expects($this->once())
->method('send');
$handler->expects($this->never())
->method('write'); // write is for individual records
$handler->setFormatter($formatter);
$handler->handleBatch($records);
}
public function testHandle()
{
$record = $this->getRecord();
$handler = $this->getMockForAbstractClass('Monolog\\Handler\\MailHandler');
$handler->expects($this->once())
->method('write');
$this->assertTrue($handler->handle($record));
}
}