mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 20:27:31 +02:00
Fix tests
This commit is contained in:
@@ -22,7 +22,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testDefaultFormatter()
|
public function testDefaultFormatter()
|
||||||
{
|
{
|
||||||
$formatter = new LogstashFormatter('test');
|
$formatter = new LogstashFormatter('test', 'hostname');
|
||||||
$record = array(
|
$record = array(
|
||||||
'level' => Logger::ERROR,
|
'level' => Logger::ERROR,
|
||||||
'level_name' => 'ERROR',
|
'level_name' => 'ERROR',
|
||||||
@@ -40,13 +40,14 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('meh', $message['@fields']['channel']);
|
$this->assertEquals('meh', $message['@fields']['channel']);
|
||||||
$this->assertContains('meh', $message['@tags']);
|
$this->assertContains('meh', $message['@tags']);
|
||||||
$this->assertEquals(Logger::ERROR, $message['@fields']['level']);
|
$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');
|
$formatter = new LogstashFormatter('mysystem');
|
||||||
|
|
||||||
$message = json_decode($formatter->format($record), true);
|
$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()
|
public function testFormatWithApplicationName()
|
||||||
{
|
{
|
||||||
$formatter = new LogstashFormatter('test', 'app');
|
$formatter = new LogstashFormatter('app', 'test');
|
||||||
$record = array(
|
$record = array(
|
||||||
'level' => Logger::ERROR,
|
'level' => Logger::ERROR,
|
||||||
'level_name' => 'ERROR',
|
'level_name' => 'ERROR',
|
||||||
|
Reference in New Issue
Block a user