DefaultFormatterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testFormatString() 0 8 1
A testFormatNonString() 0 6 1
1
<?php
2
3
namespace AbacaphiliacTest\PsrLog4Php;
4
5
use Abacaphiliac\PsrLog4Php\DefaultFormatter;
6
use Psr\Log\LogLevel;
7
8
class DefaultFormatterTest extends \PHPUnit_Framework_TestCase
9
{
10
    /** @var DefaultFormatter */
11
    private $sut;
12
13
    protected function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->sut = new DefaultFormatter();
18
    }
19
    
20
    public function testFormatString()
21
    {
22
        $actual = $this->sut->format(LogLevel::INFO, 'FooBar', array('Fizz' => 'Buzz'));
23
        
24
        self::assertContains('FooBar', $actual);
25
        self::assertContains('Fizz', $actual);
26
        self::assertContains('Buzz', $actual);
27
    }
28
    
29
    public function testFormatNonString()
30
    {
31
        $actual = $this->sut->format(LogLevel::INFO, $expected = new \stdClass(), array('Fizz' => 'Buzz'));
32
        
33
        self::assertSame($expected, $actual);
34
    }
35
}
36