scratch – Blame information for rev 120

Subversion Repositories:
Rev:
Rev Author Line No. Line
120 office 1 <?php
2  
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11  
12 namespace Monolog\Formatter;
13  
14 use Monolog\Logger;
15 use Monolog\TestCase;
16  
17 class FluentdFormatterTest extends TestCase
18 {
19 /**
20 * @covers Monolog\Formatter\FluentdFormatter::__construct
21 * @covers Monolog\Formatter\FluentdFormatter::isUsingLevelsInTag
22 */
23 public function testConstruct()
24 {
25 $formatter = new FluentdFormatter();
26 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
27 $formatter = new FluentdFormatter(false);
28 $this->assertEquals(false, $formatter->isUsingLevelsInTag());
29 $formatter = new FluentdFormatter(true);
30 $this->assertEquals(true, $formatter->isUsingLevelsInTag());
31 }
32  
33 /**
34 * @covers Monolog\Formatter\FluentdFormatter::format
35 */
36 public function testFormat()
37 {
38 $record = $this->getRecord(Logger::WARNING);
39 $record['datetime'] = new \DateTime("@0");
40  
41 $formatter = new FluentdFormatter();
42 $this->assertEquals(
43 '["test",0,{"message":"test","extra":[],"level":300,"level_name":"WARNING"}]',
44 $formatter->format($record)
45 );
46 }
47  
48 /**
49 * @covers Monolog\Formatter\FluentdFormatter::format
50 */
51 public function testFormatWithTag()
52 {
53 $record = $this->getRecord(Logger::ERROR);
54 $record['datetime'] = new \DateTime("@0");
55  
56 $formatter = new FluentdFormatter(true);
57 $this->assertEquals(
58 '["test.error",0,{"message":"test","extra":[]}]',
59 $formatter->format($record)
60 );
61 }
62 }