blob: 9f023ae7880fedc8d1e3979bf3c83827e89ce407 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<?php
namespace Asko\Loggr\Tests\Drivers;
use Asko\Loggr\Drivers\OutputDriver;
use Asko\Loggr\Loggr;
use DateTime;
use PHPUnit\Framework\TestCase;
class OutputDriverTest extends TestCase
{
/**
* @throws \Exception
*/
public function testEmergency(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.EMERGENCY: test");
$loggr = new Loggr(new OutputDriver());
$loggr->emergency('test');
}
/**
* @throws \Exception
*/
public function testAlert(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.ALERT: test");
$loggr = new Loggr(new OutputDriver());
$loggr->alert('test');
}
/**
* @throws \Exception
*/
public function testCritical(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.CRITICAL: test");
$loggr = new Loggr(new OutputDriver());
$loggr->critical('test');
}
/**
* @throws \Exception
*/
public function testError(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.ERROR: test");
$loggr = new Loggr(new OutputDriver());
$loggr->error('test');
}
/**
* @throws \Exception
*/
public function testWarning(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.WARNING: test");
$loggr = new Loggr(new OutputDriver());
$loggr->warning('test');
}
/**
* @throws \Exception
*/
public function testNotice(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.NOTICE: test");
$loggr = new Loggr(new OutputDriver());
$loggr->notice('test');
}
/**
* @throws \Exception
*/
public function testInfo(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.INFO: test");
$loggr = new Loggr(new OutputDriver());
$loggr->info('test');
}
/**
* @throws \Exception
*/
public function testDebug(): void
{
$date = (new DateTime)->format('Y-m-d H:i:s');
$this->expectOutputString("[{$date}] OutputDriverTest.DEBUG: test");
$loggr = new Loggr(new OutputDriver());
$loggr->debug('test');
}
}
|