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\Logger; |
||
15 | use Monolog\TestCase; |
||
16 | |||
17 | class FlowdockFormatterTest extends TestCase |
||
18 | { |
||
19 | /** |
||
20 | * @covers Monolog\Formatter\FlowdockFormatter::format |
||
21 | */ |
||
22 | public function testFormat() |
||
23 | { |
||
24 | $formatter = new FlowdockFormatter('test_source', 'source@test.com'); |
||
25 | $record = $this->getRecord(); |
||
26 | |||
27 | $expected = array( |
||
28 | 'source' => 'test_source', |
||
29 | 'from_address' => 'source@test.com', |
||
30 | 'subject' => 'in test_source: WARNING - test', |
||
31 | 'content' => 'test', |
||
32 | 'tags' => array('#logs', '#warning', '#test'), |
||
33 | 'project' => 'test_source', |
||
34 | ); |
||
35 | $formatted = $formatter->format($record); |
||
36 | |||
37 | $this->assertEquals($expected, $formatted['flowdock']); |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @ covers Monolog\Formatter\FlowdockFormatter::formatBatch |
||
42 | */ |
||
43 | public function testFormatBatch() |
||
44 | { |
||
45 | $formatter = new FlowdockFormatter('test_source', 'source@test.com'); |
||
46 | $records = array( |
||
47 | $this->getRecord(Logger::WARNING), |
||
48 | $this->getRecord(Logger::DEBUG), |
||
49 | ); |
||
50 | $formatted = $formatter->formatBatch($records); |
||
51 | |||
52 | $this->assertArrayHasKey('flowdock', $formatted[0]); |
||
53 | $this->assertArrayHasKey('flowdock', $formatted[1]); |
||
54 | } |
||
55 | } |