Passed
Pull Request — master (#31)
by
unknown
13:33
created

LoggerBuilderTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Graze\Monolog;
3
4
use Mockery as m;
5
use Monolog\Test\TestCase;
6
7
class LoggerBuilderTest extends TestCase
8
{
9
    public function setUp(): void
10
    {
11
        $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...
12
    }
13
14
    public function tearDown(): void
15
    {
16
        parent::tearDown();
17
        m::close();
18
    }
19
20
    public function testGetName()
21
    {
22
        $this->assertNull($this->builder->getName());
23
    }
24
25
    public function testSetName()
26
    {
27
        $this->builder->setName('foo');
28
        $this->assertSame('foo', $this->builder->getName());
29
    }
30
31
    public function testAddHandler()
32
    {
33
        $handler = m::mock('Monolog\Handler\HandlerInterface');
34
        $this->builder->addHandler($handler);
35
36
        $this->assertSame([$handler], $this->builder->getHandlers());
37
    }
38
39
    public function testGetHandlers()
40
    {
41
        $this->assertSame([], $this->builder->getHandlers());
42
    }
43
44
    public function testSetHandlers()
45
    {
46
        $handlers = [
47
            m::mock('Monolog\Handler\HandlerInterface'),
48
            m::mock('Monolog\Handler\HandlerInterface')
49
        ];
50
51
        $this->builder->setHandlers($handlers);
52
        $this->assertSame($handlers, $this->builder->getHandlers());
53
    }
54
55
    public function testAddProcessor()
56
    {
57
        $processor = function () {
58
        };
59
        $this->builder->addProcessor($processor);
60
61
        $this->assertSame([$processor], $this->builder->getProcessors());
62
    }
63
64
    public function testGetProcessors()
65
    {
66
        $this->assertSame([], $this->builder->getProcessors());
67
    }
68
69
    public function testSetProcessors()
70
    {
71
        $processors = [
72
            function () {
73
            },
74
            function () {
75
            }
76
        ];
77
78
        $this->builder->setProcessors($processors);
79
        $this->assertSame($processors, $this->builder->getProcessors());
80
    }
81
}
82