Example #1
0
 /**
  * @return void
  */
 public function testFilterByLifetime()
 {
     $lifetime = 600;
     $timestamp = time();
     $this->dateTimeMock->expects($this->once())->method('gmtTimestamp')->willReturn($timestamp);
     $this->collectionMock->expects($this->once())->method('addFieldToFilter')->with('created_at', ['gt' => $this->collectionMock->getConnection()->formatDate($timestamp - $lifetime)])->willReturnSelf();
     $this->assertEquals($this->collectionMock, $this->collectionMock->filterByLifetime($lifetime));
 }
Example #2
0
 /**
  * filterByLifetime() test
  *
  * @magentoDataFixture Magento/Security/_files/password_reset_request_events.php
  */
 public function testFilterByLifetime()
 {
     $startTime = strtotime('2016-01-19 15:42:13') - 10;
     $dateTime = $this->objectManager->create(DateTime::class);
     $currentTime = $dateTime->gmtTimestamp();
     $sessionLifetime = $currentTime - $startTime;
     $this->collectionModel->filterByLifetime($sessionLifetime)->load();
     $this->assertGreaterThanOrEqual(1, $this->collectionModel->getSize());
 }
 /**
  * filterByLifetime() test
  *
  * @magentoDataFixture Magento/Security/_files/password_reset_request_events.php
  */
 public function testFilterByLifetime()
 {
     $startTime = strtotime('2016-01-19 15:42:13') - 10;
     $securityConfig = $this->objectManager->create('\\Magento\\Security\\Helper\\SecurityConfig');
     $currentTime = $securityConfig->getCurrentTimestamp();
     $sessionLifetime = $currentTime - $startTime;
     $this->collectionModel->filterByLifetime($sessionLifetime)->load();
     $this->assertGreaterThanOrEqual(1, $this->collectionModel->getSize());
 }