public function testIsCallStillValid() { $pastTime = new \DateTime('yesterday', new \DateTimeZone('UTC')); $this->apiCall->shouldReceive('getCachedUntil')->andReturn($pastTime); $this->apiCall->shouldReceive('getEarliestNextCall')->andReturn($pastTime); $this->assertTrue($this->apiTimeCalculator->isCallStillValid($this->apiCall)); }
public function setUp() { $this->noKeySectionApi = m::mock('Tarioch\\EveapiFetcherBundle\\Component\\Section\\NoKeySectionApi'); $this->keySectionApi = m::mock('Tarioch\\EveapiFetcherBundle\\Component\\Section\\KeySectionApi'); $this->apiCall = m::mock('Tarioch\\EveapiFetcherBundle\\Entity\\ApiCall'); $this->api = m::mock('Tarioch\\EveapiFetcherBundle\\Entity\\Api'); $this->factory = new SectionApiFactory($this->keySectionApi, $this->noKeySectionApi); $this->apiCall->shouldReceive('getApi')->andReturn($this->api); }
private function mockPrepareApiCall() { $keyId = 'keyId'; $vcode = 'vcode'; $this->apiCall->shouldReceive('getKey')->andReturn($this->key); $this->key->shouldReceive('isActive')->andReturn(true); $this->key->shouldReceive('getKeyId')->andReturn($keyId); $this->key->shouldReceive('getVcode')->andReturn($vcode); $this->phealFactory->shouldReceive('createEveOnline')->with($keyId, $vcode)->andReturn($this->pheal); $this->apiCall->shouldReceive('getApi')->andReturn($this->api); $this->specificApiFactory->shouldReceive('create')->with($this->api)->andReturn($this->specificApi); }
private function mockFinishApiCall() { $this->apiTimeCalculator->shouldReceive('calculateEarliestNextCall')->with($this->apiCall)->andReturn(self::EARLIEST_NEXT_CALL); $this->apiCall->shouldReceive('setEarliestNextCall')->with(self::EARLIEST_NEXT_CALL); $this->logger->shouldReceive('info'); }