1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-31 18:30:15 +02:00

Fix tests

This commit is contained in:
Jordi Boggiano
2012-12-14 12:27:44 +01:00
parent 8dd213fcf1
commit 0df12342ef

View File

@@ -22,7 +22,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testDefaultFormatter()
{
$formatter = new LogstashFormatter('test');
$formatter = new LogstashFormatter('test', 'hostname');
$record = array(
'level' => Logger::ERROR,
'level_name' => 'ERROR',
@@ -40,13 +40,14 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('meh', $message['@fields']['channel']);
$this->assertContains('meh', $message['@tags']);
$this->assertEquals(Logger::ERROR, $message['@fields']['level']);
$this->assertEquals('test', $message['@source']);
$this->assertEquals('test', $message['@type']);
$this->assertEquals('hostname', $message['@source']);
$formatter = new LogstashFormatter('mysystem');
$message = json_decode($formatter->format($record), true);
$this->assertEquals('mysystem', $message['@source']);
$this->assertEquals('mysystem', $message['@type']);
}
/**
@@ -140,7 +141,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
public function testFormatWithApplicationName()
{
$formatter = new LogstashFormatter('test', 'app');
$formatter = new LogstashFormatter('app', 'test');
$record = array(
'level' => Logger::ERROR,
'level_name' => 'ERROR',