|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0 |
|
5
|
|
|
* @copyright Aimeos (aimeos.org), 2021 |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
|
|
9
|
|
|
namespace Aimeos\MW\Logger; |
|
10
|
|
|
|
|
11
|
|
|
|
|
12
|
|
|
class TraitsTest extends \PHPUnit\Framework\TestCase |
|
13
|
|
|
{ |
|
14
|
|
|
private $object; |
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
protected function setUp() : void |
|
18
|
|
|
{ |
|
19
|
|
|
$this->object = $this->getMockBuilder( \Aimeos\MW\Logger\Errorlog::class ) |
|
20
|
|
|
->setMethods( ['log'] ) |
|
21
|
|
|
->getMock(); |
|
22
|
|
|
} |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
protected function tearDown() : void |
|
26
|
|
|
{ |
|
27
|
|
|
unset( $this->object ); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
|
|
31
|
|
|
public function testEmergency() |
|
32
|
|
|
{ |
|
33
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
34
|
|
|
->will( $this->returnSelf() ); |
|
35
|
|
|
|
|
36
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->emergency( 'emergency' ) ); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
public function testAlert() |
|
41
|
|
|
{ |
|
42
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
43
|
|
|
->will( $this->returnSelf() ); |
|
44
|
|
|
|
|
45
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->alert( 'alert' ) ); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
|
|
49
|
|
|
public function testCritical() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
52
|
|
|
->will( $this->returnSelf() ); |
|
53
|
|
|
|
|
54
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->critical( 'critical' ) ); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
|
|
58
|
|
|
public function testError() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
61
|
|
|
->will( $this->returnSelf() ); |
|
62
|
|
|
|
|
63
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->error( 'error' ) ); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
|
|
67
|
|
|
public function testWarning() |
|
68
|
|
|
{ |
|
69
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
70
|
|
|
->will( $this->returnSelf() ); |
|
71
|
|
|
|
|
72
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->warning( 'warning' ) ); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
|
|
76
|
|
|
public function testNotice() |
|
77
|
|
|
{ |
|
78
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
79
|
|
|
->will( $this->returnSelf() ); |
|
80
|
|
|
|
|
81
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->notice( 'notice' ) ); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
public function testInfo() |
|
86
|
|
|
{ |
|
87
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
88
|
|
|
->will( $this->returnSelf() ); |
|
89
|
|
|
|
|
90
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->info( 'info' ) ); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
|
|
94
|
|
|
public function testDebug() |
|
95
|
|
|
{ |
|
96
|
|
|
$this->object->expects( $this->once() )->method( 'log' ) |
|
97
|
|
|
->will( $this->returnSelf() ); |
|
98
|
|
|
|
|
99
|
|
|
$this->assertInstanceOf( \Aimeos\MW\Logger\Iface::class, $this->object->debug( 'debug' ) ); |
|
100
|
|
|
} |
|
101
|
|
|
} |
|
102
|
|
|
|