/** * @test */ public function setCachedValueForRequestTest() { $response = new \Bullet\Response(); $response->content('Test content'); $uri = 'MyAliasedModel'; $request = $this->buildRequestWithUri($uri); $this->fixture->setCachedValueForRequest($request, $response); $cachedResponse = $this->fixture->getCachedValueForRequest($request); $this->assertInstanceOf('Bullet\\Response', $cachedResponse); $this->assertEquals('Test content', $cachedResponse); }
/** * @test */ public function getCachedValueForRequestTest() { $uri = 'MyAliasedModel' . time(); $responseArray = array('content' => 'the content', 'status' => 200, 'content-type' => null, 'encoding' => null, 'last-modified' => null); $request = $this->buildRequestWithUri($uri); /** @var \TYPO3\CMS\Core\Cache\Frontend\VariableFrontend|\PHPUnit_Framework_MockObject_MockObject $cacheInstance */ $cacheInstance = $this->getMock('TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend', array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag'), array(), '', FALSE); $cacheInstance->expects($this->atLeastOnce())->method('get')->will($this->returnValue($responseArray)); $this->fixture->setCacheInstance($cacheInstance); $response = $this->fixture->getCachedValueForRequest($request); $this->assertInstanceOf('Bullet\\Response', $response); $this->assertSame($responseArray['content'], $response->content()); $this->assertSame($responseArray['status'], $response->status()); }