1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-10 15:14:14 +02:00

More test coverage of handlers/formatters

This commit is contained in:
Jordi Boggiano
2011-06-29 19:24:29 +02:00
parent 9c2f081c9a
commit 61d5a23e41
3 changed files with 74 additions and 30 deletions

View File

@@ -12,20 +12,24 @@
namespace Monolog\Formatter;
use Monolog\Logger;
use Monolog\TestCase;
class JsonFormatterTest extends \PHPUnit_Framework_TestCase
class JsonFormatterTest extends TestCase
{
public function testFormat()
{
$formatter = new JsonFormatter();
$message = $formatter->format($msg = array(
'level_name' => 'WARNING',
'channel' => 'log',
'context' => array(),
'message' => array('foo'),
'datetime' => new \DateTime,
'extra' => array(),
));
$this->assertEquals(json_encode($msg), $message);
$record = $this->getRecord();
$this->assertEquals(json_encode($record), $formatter->format($record));
}
public function testFormatBatch()
{
$formatter = new JsonFormatter();
$records = array(
$this->getRecord(Logger::WARNING),
$this->getRecord(Logger::DEBUG),
);
$this->assertEquals(json_encode($records), $formatter->formatBatch($records));
}
}