|
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(); |
|
|
|
|
|
|
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(array($handler), $this->builder->getHandlers()); |
|
|
|
|
|
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
public function testGetHandlers() |
|
33
|
|
|
{ |
|
34
|
|
|
$this->assertSame(array(), $this->builder->getHandlers()); |
|
|
|
|
|
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
public function testSetHandlers() |
|
38
|
|
|
{ |
|
39
|
|
|
$handlers = array( |
|
|
|
|
|
|
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
|
|
|
$this->builder->addProcessor($processor); |
|
52
|
|
|
|
|
53
|
|
|
$this->assertSame(array($processor), $this->builder->getProcessors()); |
|
|
|
|
|
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function testGetProcessors() |
|
57
|
|
|
{ |
|
58
|
|
|
$this->assertSame(array(), $this->builder->getProcessors()); |
|
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
public function testSetProcessors() |
|
62
|
|
|
{ |
|
63
|
|
|
$processors = array( |
|
|
|
|
|
|
64
|
|
|
function(){}, |
|
|
|
|
|
|
65
|
|
|
function(){} |
|
|
|
|
|
|
66
|
|
|
); |
|
67
|
|
|
|
|
68
|
|
|
$this->builder->setProcessors($processors); |
|
69
|
|
|
$this->assertSame($processors, $this->builder->getProcessors()); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|