@@ -25,19 +25,13 @@ class LogTest extends \PHPUnit_Framework_TestCase
25
25
*/
26
26
protected $ loggerMock ;
27
27
28
- /**
29
- * @var DateTime | \PHPUnit_Framework_MockObject_MockObject
30
- */
31
- protected $ dateTime ;
32
-
33
28
/**
34
29
* @return void
35
30
*/
36
31
public function setUp ()
37
32
{
38
33
$ this ->loggerMock = $ this ->getMock ('Magento\Customer\Model\Logger ' , [], [], '' , false );
39
- $ this ->dateTime = $ this ->getMock ('Magento\Framework\Stdlib\DateTime ' , [], [], '' , false );
40
- $ this ->logObserver = new Log ($ this ->loggerMock , $ this ->dateTime );
34
+ $ this ->logObserver = new Log ($ this ->loggerMock );
41
35
}
42
36
43
37
/**
@@ -46,7 +40,6 @@ public function setUp()
46
40
public function testLogLastLoginAt ()
47
41
{
48
42
$ id = 1 ;
49
- $ time = 123 ;
50
43
51
44
$ observerMock = $ this ->getMock ('Magento\Framework\Event\Observer ' , [], [], '' , false );
52
45
$ eventMock = $ this ->getMock ('Magento\Framework\Event ' , ['getCustomer ' ], [], '' , false );
@@ -62,13 +55,8 @@ public function testLogLastLoginAt()
62
55
->method ('getId ' )
63
56
->willReturn ($ id );
64
57
65
- $ this ->dateTime ->expects ($ this ->once ())
66
- ->method ('now ' )
67
- ->willReturn ($ time );
68
-
69
58
$ this ->loggerMock ->expects ($ this ->once ())
70
- ->method ('log ' )
71
- ->with ($ id , ['last_login_at ' => $ time ]);
59
+ ->method ('log ' );
72
60
73
61
$ this ->logObserver ->logLastLoginAt ($ observerMock );
74
62
}
@@ -79,7 +67,6 @@ public function testLogLastLoginAt()
79
67
public function testLogLastLogoutAt ()
80
68
{
81
69
$ id = 1 ;
82
- $ time = 123 ;
83
70
84
71
$ observerMock = $ this ->getMock ('Magento\Framework\Event\Observer ' , [], [], '' , false );
85
72
$ eventMock = $ this ->getMock ('Magento\Framework\Event ' , ['getCustomer ' ], [], '' , false );
@@ -95,13 +82,8 @@ public function testLogLastLogoutAt()
95
82
->method ('getId ' )
96
83
->willReturn ($ id );
97
84
98
- $ this ->dateTime ->expects ($ this ->once ())
99
- ->method ('now ' )
100
- ->willReturn ($ time );
101
-
102
85
$ this ->loggerMock ->expects ($ this ->once ())
103
- ->method ('log ' )
104
- ->with ($ id , ['last_logout_at ' => $ time ]);
86
+ ->method ('log ' );
105
87
106
88
$ this ->logObserver ->logLastLogoutAt ($ observerMock );
107
89
}
0 commit comments