本文整理汇总了PHP中Zend_Feed::setHttpClient方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Feed::setHttpClient方法的具体用法?PHP Zend_Feed::setHttpClient怎么用?PHP Zend_Feed::setHttpClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Feed
的用法示例。
在下文中一共展示了Zend_Feed::setHttpClient方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->_adapter = new Zend_Http_Client_Adapter_Test();
Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $this->_adapter)));
$this->_client = Zend_Feed::getHttpClient();
$this->_feedDir = dirname(__FILE__) . '/_files';
}
示例2: setUp
public function setUp()
{
if (!defined('TESTS_ZEND_FEED_IMPORT_ONLINE_BASEURI') || !constant('TESTS_ZEND_FEED_IMPORT_ONLINE_BASEURI')) {
$this->markTestSkipped('ONLINE feed tests are not enabled');
}
$this->baseUri = rtrim(constant('TESTS_ZEND_FEED_IMPORT_ONLINE_BASEURI'), '/');
Zend_Feed::setHttpClient(new Zend_Http_Client());
}
示例3: testEdit
public function testEdit()
{
Zend_Feed::setHttpClient(new TestClient());
/* The base feed URI is the same as the POST URI, so just supply the
* Zend_Feed_EntryAtom object with that. */
$entry = new Zend_Feed_EntryAtom($this->uri, file_get_contents(dirname(__FILE__) . '/_files/AtomPublishingTest-before-update.xml'));
/* Initial state. */
$this->assertEquals('2005-05-23T16:26:00-08:00', $entry->updated(), 'Initial state of updated timestamp does not match');
$this->assertEquals('http://fubar.com/myFeed/1/1/', $entry->link('edit'), 'Initial state of edit link does not match');
/* Just change the entry's properties directly. */
$entry->content = '1.2';
/* Then save the changes. */
$entry->save();
/* New state. */
$this->assertEquals('1.2', $entry->content(), 'Content change did not stick');
$this->assertEquals('2005-05-23T16:27:00-08:00', $entry->updated(), 'New updated link is not correct');
$this->assertEquals('http://fubar.com/myFeed/1/2/', $entry->link('edit'), 'New edit link is not correct');
}
示例4: getNews
/**
* Get News
*
* @return array
*/
public function getNews()
{
if ($this->_news === null) {
// Get News configuration options from the application.ini file
$newsConfig = $this->getOptions();
Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('timeout' => $newsConfig['poll_timeout'])));
foreach ($newsConfig['channels'] as $name => $cconf) {
try {
$class = 'Zend_Feed_' . ucfirst($cconf['type']);
$channel[$name]['channel'] = new $class($cconf['source']);
$channel[$name]['key'] = $cconf['key'];
} catch (Exception $e) {
$channel[$name]['channel'] = array();
$channel[$name]['key'] = $cconf['key'];
}
}
$this->_news = $channel;
}
return $this->_news;
}
示例5: setUp
public function setUp()
{
Zend_Feed::setHttpClient(new Zend_Http_Client_File());
$this->_client = Zend_Feed::getHttpClient();
$this->_feedDir = dirname(__FILE__) . '/_files';
}
示例6: testFindFeedsIncludesUriAsArrayKey
/**
* @issue ZF-5903
*/
public function testFindFeedsIncludesUriAsArrayKey()
{
if (!defined('TESTS_ZEND_FEED_READER_ONLINE_ENABLED') || !constant('TESTS_ZEND_FEED_READER_ONLINE_ENABLED')) {
$this->markTestSkipped('testFindFeedsIncludesUriAsArrayKey() requires a network connection');
return;
}
Zend_Feed::setHttpClient(new Zend_Http_Client());
$feeds = Zend_Feed::findFeeds('http://www.planet-php.net');
$this->assertEquals(array('http://www.planet-php.org:80/rss/', 'http://www.planet-php.org:80/rdf/'), array_keys($feeds));
}
示例7: setUp
public function setUp()
{
Zend_Feed::setHttpClient(new Zend_HttpClient_File());
$this->_client = Zend_Feed::getHttpClient();
$this->_feedDir = 'Zend/Feed/_files';
}
示例8: getFeed
/**
* Retreive feed object
*
* @param string $uri
* @return Zend_Feed
*/
public function getFeed($uri)
{
$feed = new Zend_Feed();
$this->_httpClient->resetParameters();
$feed->setHttpClient($this->_httpClient);
return $feed->import($uri);
}
示例9: testNewsshortActionFail
public function testNewsshortActionFail()
{
$adapter = new Zend_Http_Client_Adapter_Test();
$adapter->setNextRequestWillFail(true);
Zend_Feed::setHttpClient(new Zend_Http_Client(null, array('adapter' => $adapter)));
$this->dispatch('/index/newsshort');
$this->assertController('index');
$this->assertAction('newsshort');
$this->assertQuery('p.messagebox.warning');
}