scratch – Blame information for rev 120
?pathlinks?
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\TestCase; |
||
15 | |||
16 | class LogglyFormatterTest extends TestCase |
||
17 | { |
||
18 | /** |
||
19 | * @covers Monolog\Formatter\LogglyFormatter::__construct |
||
20 | */ |
||
21 | public function testConstruct() |
||
22 | { |
||
23 | $formatter = new LogglyFormatter(); |
||
24 | $this->assertEquals(LogglyFormatter::BATCH_MODE_NEWLINES, $formatter->getBatchMode()); |
||
25 | $formatter = new LogglyFormatter(LogglyFormatter::BATCH_MODE_JSON); |
||
26 | $this->assertEquals(LogglyFormatter::BATCH_MODE_JSON, $formatter->getBatchMode()); |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @covers Monolog\Formatter\LogglyFormatter::format |
||
31 | */ |
||
32 | public function testFormat() |
||
33 | { |
||
34 | $formatter = new LogglyFormatter(); |
||
35 | $record = $this->getRecord(); |
||
36 | $formatted_decoded = json_decode($formatter->format($record), true); |
||
37 | $this->assertArrayHasKey("timestamp", $formatted_decoded); |
||
38 | $this->assertEquals(new \DateTime($formatted_decoded["timestamp"]), $record["datetime"]); |
||
39 | } |
||
40 | } |