Example #1
0
 public function testWithOutCache()
 {
     $this->cacheMock->expects($this->once())->method('has')->will($this->returnValue(false));
     $this->cacheMock->expects($this->once())->method('set')->will($this->returnValue(true));
     $responseMock = $this->getMockBuilder('Guzzle\\Http\\Message\\Response')->disableOriginalConstructor()->getMock();
     $responseMock->expects($this->once())->method('isSuccessful')->will($this->returnValue(true));
     $responseMock->expects($this->once())->method('getBody')->will($this->returnValue(array(new Item())));
     $requestMock = $this->getMockBuilder('Guzzle\\Http\\Message\\Request')->disableOriginalConstructor()->getMock();
     $requestMock->expects($this->once())->method('send')->will($this->returnValue($responseMock));
     $this->httpMock->expects($this->once())->method('get')->will($this->returnValue($requestMock));
     $this->fastFeed->fetch('desarrolla2');
 }
Example #2
0
 public function testWithOutCache()
 {
     $this->cacheMock->expects($this->once())->method('has')->will($this->returnValue(false));
     $this->cacheMock->expects($this->once())->method('set')->will($this->returnValue(true));
     $expectedResponse = $this->httpMock->getConfiguration()->getMessageFactory()->createResponse(200, RequestInterface::PROTOCOL_VERSION_1_1, ['Content-Type: application/xml'], '<?xml version="1.0" encoding="utf-8"?>
         <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"
         xmlns:dc="http://purl.org/dc/elements/1.1/"
         xmlns:media="http://search.yahoo.com/mrss/"
         >
         <cache>
             <key>rss:9a0b0cb47a5834ce21b22b6a75e404544fe69aa9</key>
             <lastModKey>rss_modified:rss:9a0b0cb47a5834ce21b22b6a75e404544fe69aa9</lastModKey>
         </cache>
         <channel>
             <title>Test Response</title>
             <link>http://localhost/feed.xml</link>
             <description>A test feed.</description>
             <language>en-us</language>
             <lastBuildDate>Sun, 20 Sep 2015 20:17:05 -0700</lastBuildDate>
         </channel>
         </rss>');
     $this->httpMock->appendResponse($expectedResponse);
     $this->fastFeed->fetch('desarrolla2');
 }
 /**
  * Flush the whole storage
  *
  * @return bool
  */
 public function flush()
 {
     return $this->cache->dropCache();
 }