diff --git a/app/code/Magento/Customer/Model/Observer/Log.php b/app/code/Magento/Customer/Model/Observer/Log.php index c83f8abee8c35d0ae9c8b456783529af67e8c1fd..539221b5e378f47a537816c4d1e3a14457ab6ea1 100644 --- a/app/code/Magento/Customer/Model/Observer/Log.php +++ b/app/code/Magento/Customer/Model/Observer/Log.php @@ -21,21 +21,12 @@ class Log */ protected $logger; - /** - * Date formats converter. - * - * @var DateTime - */ - protected $dateTime; - /** * @param Logger $logger - * @param DateTime $dateTime */ - public function __construct(Logger $logger, DateTime $dateTime) + public function __construct(Logger $logger) { $this->logger = $logger; - $this->dateTime = $dateTime; } /** diff --git a/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php b/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php index 86db3e2138645026a5ac0c3527d1158f3f7b5fd3..fcd3ff2c58f76fff1619f3804c0c079eb8c5c397 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Observer/LogTest.php @@ -25,19 +25,13 @@ class LogTest extends \PHPUnit_Framework_TestCase */ protected $loggerMock; - /** - * @var DateTime | \PHPUnit_Framework_MockObject_MockObject - */ - protected $dateTime; - /** * @return void */ public function setUp() { $this->loggerMock = $this->getMock('Magento\Customer\Model\Logger', [], [], '', false); - $this->dateTime = $this->getMock('Magento\Framework\Stdlib\DateTime', [], [], '', false); - $this->logObserver = new Log($this->loggerMock, $this->dateTime); + $this->logObserver = new Log($this->loggerMock); } /** @@ -46,7 +40,6 @@ class LogTest extends \PHPUnit_Framework_TestCase public function testLogLastLoginAt() { $id = 1; - $time = 123; $observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); $eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false); @@ -62,13 +55,8 @@ class LogTest extends \PHPUnit_Framework_TestCase ->method('getId') ->willReturn($id); - $this->dateTime->expects($this->once()) - ->method('now') - ->willReturn($time); - $this->loggerMock->expects($this->once()) - ->method('log') - ->with($id, ['last_login_at' => $time]); + ->method('log'); $this->logObserver->logLastLoginAt($observerMock); } @@ -79,7 +67,6 @@ class LogTest extends \PHPUnit_Framework_TestCase public function testLogLastLogoutAt() { $id = 1; - $time = 123; $observerMock = $this->getMock('Magento\Framework\Event\Observer', [], [], '', false); $eventMock = $this->getMock('Magento\Framework\Event', ['getCustomer'], [], '', false); @@ -95,13 +82,8 @@ class LogTest extends \PHPUnit_Framework_TestCase ->method('getId') ->willReturn($id); - $this->dateTime->expects($this->once()) - ->method('now') - ->willReturn($time); - $this->loggerMock->expects($this->once()) - ->method('log') - ->with($id, ['last_logout_at' => $time]); + ->method('log'); $this->logObserver->logLastLogoutAt($observerMock); }