public function testReturnsRequestcanCacheRequest() { $strategy = new DefaultCanCacheStrategy(); $response = $this->getMockBuilder('Guzzle\\Http\\Message\\Request')->disableOriginalConstructor()->setMethods(array('canCache'))->getMock(); $response->expects($this->once())->method('canCache')->will($this->returnValue(true)); $this->assertTrue($strategy->canCacheRequest($response)); }
public function testCanCacheResponse() { $response = $this->getMockBuilder('Guzzle\\Http\\Message\\Response')->setMethods(array('canCache'))->setConstructorArgs(array(200))->getMock(); $response->expects($this->once())->method('canCache')->will($this->returnValue(true)); $strategy = new DefaultCanCacheStrategy(); $this->assertTrue($strategy->canCacheResponse($response)); }
public function canCacheResponse(Response $response) { return $this->responseCallback ? call_user_func($this->responseCallback, $response) : parent::canCacheResponse($response); }