浏览代码

Fix tests

Jordi Boggiano 13 年之前
父节点
当前提交
0df12342ef
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      tests/Monolog/Formatter/LogstashFormatterTest.php

+ 5 - 4
tests/Monolog/Formatter/LogstashFormatterTest.php

@@ -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',