コード例 #1
0
 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));
 }
コード例 #2
0
 public function canCacheRequest(RequestInterface $request)
 {
     return $this->requestCallback ? call_user_func($this->requestCallback, $request) : parent::canCacheRequest($request);
 }
コード例 #3
0
 public function testDoesNotCacheNoStore()
 {
     $strategy = new DefaultCanCacheStrategy();
     $request = new Request('GET', 'http://foo.com', array('cache-control' => 'no-store'));
     $this->assertFalse($strategy->canCacheRequest($request));
 }