Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LogTest.php
Go to the documentation of this file.
1 <?php
7 
11 class LogTest extends \PHPUnit\Framework\TestCase
12 {
18  protected $log;
19 
23  protected $logData = [
24  'customer_id' => 369,
25  'last_login_at' => '2015-03-04 12:00:00',
26  'last_visit_at' => '2015-03-04 12:01:00',
27  'last_logout_at' => '2015-03-04 12:05:00',
28  ];
29 
33  protected function setUp()
34  {
35  $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
36 
37  $this->log = $objectManagerHelper->getObject(
38  \Magento\Customer\Model\Log::class,
39  [
40  'customerId' => $this->logData['customer_id'],
41  'lastLoginAt' => $this->logData['last_login_at'],
42  'lastVisitAt' => $this->logData['last_visit_at'],
43  'lastLogoutAt' => $this->logData['last_logout_at']
44  ]
45  );
46  }
47 
51  public function testGetCustomerId()
52  {
53  $this->assertEquals($this->logData['customer_id'], $this->log->getCustomerId());
54  }
55 
59  public function testGetLastLoginAt()
60  {
61  $this->assertEquals($this->logData['last_login_at'], $this->log->getLastLoginAt());
62  }
63 
67  public function testGetLastVisitAt()
68  {
69  $this->assertEquals($this->logData['last_visit_at'], $this->log->getLastVisitAt());
70  }
71 
75  public function testGetLastLogoutAt()
76  {
77  $this->assertEquals($this->logData['last_logout_at'], $this->log->getLastLogoutAt());
78  }
79 }