本文整理汇总了PHP中Zend\Feed\Reader\Reader::importRemoteFeed方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::importRemoteFeed方法的具体用法?PHP Reader::importRemoteFeed怎么用?PHP Reader::importRemoteFeed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Feed\Reader\Reader
的用法示例。
在下文中一共展示了Reader::importRemoteFeed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testImportRemoteFeedMethodPerformsAsExpected
public function testImportRemoteFeedMethodPerformsAsExpected()
{
$uri = 'http://example.com/feeds/reader.xml';
$feedContents = file_get_contents($this->feedSamplePath . '/Reader/rss20.xml');
$response = $this->getMock('Zend\\Feed\\Reader\\Http\\ResponseInterface', array('getStatusCode', 'getBody'));
$response->expects($this->once())->method('getStatusCode')->will($this->returnValue(200));
$response->expects($this->once())->method('getBody')->will($this->returnValue($feedContents));
$client = $this->getMock('Zend\\Feed\\Reader\\Http\\ClientInterface', array('get'));
$client->expects($this->once())->method('get')->with($this->equalTo($uri))->will($this->returnValue($response));
$feed = Reader\Reader::importRemoteFeed($uri, $client);
$this->assertInstanceOf('Zend\\Feed\\Reader\\Feed\\FeedInterface', $feed);
$type = Reader\Reader::detectType($feed);
$this->assertEquals(Reader\Reader::TYPE_RSS_20, $type);
}