1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Onoi\MessageReporter\Tests\Unit; |
4
|
|
|
|
5
|
|
|
use Onoi\MessageReporter\MessageReporterFactory; |
6
|
|
|
use PHPUnit\Framework\TestCase; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @covers \Onoi\MessageReporter\MessageReporterFactory |
10
|
|
|
* @group onoi-message-reporter |
11
|
|
|
* |
12
|
|
|
* @since 1.0 |
13
|
|
|
* |
14
|
|
|
* @license GNU GPL v2+ |
15
|
|
|
* @author mwjames |
16
|
|
|
*/ |
17
|
|
|
class MessageReporterFactoryTest extends TestCase { |
18
|
|
|
|
19
|
|
|
public function testCanConstruct() { |
20
|
|
|
|
21
|
|
|
$this->assertInstanceOf( |
22
|
|
|
'\Onoi\MessageReporter\MessageReporterFactory', |
23
|
|
|
new MessageReporterFactory() |
24
|
|
|
); |
25
|
|
|
|
26
|
|
|
$this->assertInstanceOf( |
27
|
|
|
'\Onoi\MessageReporter\MessageReporterFactory', |
28
|
|
|
MessageReporterFactory::getInstance() |
29
|
|
|
); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testClear() { |
33
|
|
|
|
34
|
|
|
$instance = MessageReporterFactory::getInstance(); |
35
|
|
|
|
36
|
|
|
$this->assertSame( |
37
|
|
|
$instance, |
38
|
|
|
MessageReporterFactory::getInstance() |
39
|
|
|
); |
40
|
|
|
|
41
|
|
|
$instance->clear(); |
42
|
|
|
|
43
|
|
|
$this->assertNotSame( |
44
|
|
|
$instance, |
45
|
|
|
MessageReporterFactory::getInstance() |
46
|
|
|
); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function testCanConstructNullMessageReporter() { |
50
|
|
|
|
51
|
|
|
$instance = new MessageReporterFactory(); |
52
|
|
|
|
53
|
|
|
$this->assertInstanceOf( |
54
|
|
|
'\Onoi\MessageReporter\NullMessageReporter', |
55
|
|
|
$instance->newNullMessageReporter() |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function testCanConstructObservableMessageReporter() { |
60
|
|
|
|
61
|
|
|
$instance = new MessageReporterFactory(); |
62
|
|
|
|
63
|
|
|
$this->assertInstanceOf( |
64
|
|
|
'\Onoi\MessageReporter\ObservableMessageReporter', |
65
|
|
|
$instance->newObservableMessageReporter() |
66
|
|
|
); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testCanConstructSpyMessageReporter() { |
70
|
|
|
|
71
|
|
|
$instance = new MessageReporterFactory(); |
72
|
|
|
|
73
|
|
|
$this->assertInstanceOf( |
74
|
|
|
'\Onoi\MessageReporter\SpyMessageReporter', |
75
|
|
|
$instance->newSpyMessageReporter() |
76
|
|
|
); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
} |
80
|
|
|
|