LoggerBuilderTest   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 23
dl 0
loc 67
rs 10
c 0
b 0
f 0
wmc 9

9 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetHandlers() 0 3 1
A testSetName() 0 4 1
A setUp() 0 3 1
A testGetName() 0 3 1
A testGetProcessors() 0 3 1
A testSetHandlers() 0 9 1
A testAddHandler() 0 6 1
A testSetProcessors() 0 11 1
A testAddProcessor() 0 7 1
1
<?php
2
namespace Graze\Monolog;
3
4
use Mockery as m;
5
6
class LoggerBuilderTest extends \PHPUnit_Framework_TestCase
7
{
8
    public function setUp()
9
    {
10
        $this->builder = new LoggerBuilder();
0 ignored issues
show
Bug Best Practice introduced by
The property builder does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
11
    }
12
13
    public function testGetName()
14
    {
15
        $this->assertNull($this->builder->getName());
16
    }
17
18
    public function testSetName()
19
    {
20
        $this->builder->setName('foo');
21
        $this->assertSame('foo', $this->builder->getName());
22
    }
23
24
    public function testAddHandler()
25
    {
26
        $handler = m::mock('Monolog\Handler\HandlerInterface');
27
        $this->builder->addHandler($handler);
28
29
        $this->assertSame([$handler], $this->builder->getHandlers());
30
    }
31
32
    public function testGetHandlers()
33
    {
34
        $this->assertSame([], $this->builder->getHandlers());
35
    }
36
37
    public function testSetHandlers()
38
    {
39
        $handlers = [
40
            m::mock('Monolog\Handler\HandlerInterface'),
41
            m::mock('Monolog\Handler\HandlerInterface')
42
        ];
43
44
        $this->builder->setHandlers($handlers);
45
        $this->assertSame($handlers, $this->builder->getHandlers());
46
    }
47
48
    public function testAddProcessor()
49
    {
50
        $processor = function () {
51
        };
52
        $this->builder->addProcessor($processor);
53
54
        $this->assertSame([$processor], $this->builder->getProcessors());
55
    }
56
57
    public function testGetProcessors()
58
    {
59
        $this->assertSame([], $this->builder->getProcessors());
60
    }
61
62
    public function testSetProcessors()
63
    {
64
        $processors = [
65
            function () {
66
            },
67
            function () {
68
            }
69
        ];
70
71
        $this->builder->setProcessors($processors);
72
        $this->assertSame($processors, $this->builder->getProcessors());
73
    }
74
}
75