Skip to content

Commit 59b4ea9

Browse files
committed
MAGETWO-34363: Pull request processing
1 parent 4214997 commit 59b4ea9

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

app/code/Magento/Customer/Model/Observer/Log.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,12 @@ class Log
2121
*/
2222
protected $logger;
2323

24-
/**
25-
* Date formats converter.
26-
*
27-
* @var DateTime
28-
*/
29-
protected $dateTime;
30-
3124
/**
3225
* @param Logger $logger
33-
* @param DateTime $dateTime
3426
*/
35-
public function __construct(Logger $logger, DateTime $dateTime)
27+
public function __construct(Logger $logger)
3628
{
3729
$this->logger = $logger;
38-
$this->dateTime = $dateTime;
3930
}
4031

4132
/**

app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,13 @@ class LogTest extends \PHPUnit_Framework_TestCase
2525
*/
2626
protected $loggerMock;
2727

28-
/**
29-
* @var DateTime | \PHPUnit_Framework_MockObject_MockObject
30-
*/
31-
protected $dateTime;
32-
3328
/**
3429
* @return void
3530
*/
3631
public function setUp()
3732
{
3833
$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);
4135
}
4236

4337
/**
@@ -46,7 +40,6 @@ public function setUp()
4640
public function testLogLastLoginAt()
4741
{
4842
$id = 1;
49-
$time = 123;
5043

5144
$observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false);
5245
$eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false);
@@ -62,13 +55,8 @@ public function testLogLastLoginAt()
6255
->method('getId')
6356
->willReturn($id);
6457

65-
$this->dateTime->expects($this->once())
66-
->method('now')
67-
->willReturn($time);
68-
6958
$this->loggerMock->expects($this->once())
70-
->method('log')
71-
->with($id, ['last_login_at' => $time]);
59+
->method('log');
7260

7361
$this->logObserver->logLastLoginAt($observerMock);
7462
}
@@ -79,7 +67,6 @@ public function testLogLastLoginAt()
7967
public function testLogLastLogoutAt()
8068
{
8169
$id = 1;
82-
$time = 123;
8370

8471
$observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false);
8572
$eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false);
@@ -95,13 +82,8 @@ public function testLogLastLogoutAt()
9582
->method('getId')
9683
->willReturn($id);
9784

98-
$this->dateTime->expects($this->once())
99-
->method('now')
100-
->willReturn($time);
101-
10285
$this->loggerMock->expects($this->once())
103-
->method('log')
104-
->with($id, ['last_logout_at' => $time]);
86+
->method('log');
10587

10688
$this->logObserver->logLastLogoutAt($observerMock);
10789
}

0 commit comments

Comments
 (0)