Exemplo n.º 1
0
 public function testGetConsumerExpirationPeriodExpired()
 {
     $dateHelperMock = $this->getMockBuilder('Magento\\Framework\\Stdlib\\DateTime\\DateTime')->disableOriginalConstructor()->getMock();
     $dateHelperMock->expects($this->at(0))->method('gmtTimestamp')->willReturn(time());
     $dateHelperMock->expects($this->at(1))->method('gmtTimestamp')->willReturn(time() - 1000);
     $dateHelper = new \ReflectionProperty('Magento\\Integration\\Model\\Oauth\\Consumer', '_dateHelper');
     $dateHelper->setAccessible(true);
     $dateHelper->setValue($this->consumerModel, $dateHelperMock);
     $this->consumerModel->setUpdatedAt(time());
     $this->assertFalse($this->consumerModel->isValidForTokenExchange());
 }
Exemplo n.º 2
0
 public function testGetConsumerExpirationPeriodExpired()
 {
     $this->resourceMock->expects($this->once())->method('getTimeInSecondsSinceCreation')->will($this->returnValue(400));
     $this->consumerModel->setCreatedAt(time());
     $this->assertFalse($this->consumerModel->isValidForTokenExchange());
 }