1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-11 23:54:04 +02:00

Added an abstract MailHandler class

This commit is contained in:
Gyula Sallai
2011-04-22 17:41:10 +02:00
parent 3b54f13e72
commit 1279194192
3 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
<?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));
}
}