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'; }
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()); }
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'); }
/** * 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; }
public function setUp() { Zend_Feed::setHttpClient(new Zend_Http_Client_File()); $this->_client = Zend_Feed::getHttpClient(); $this->_feedDir = dirname(__FILE__) . '/_files'; }
/** * @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)); }
public function setUp() { Zend_Feed::setHttpClient(new Zend_HttpClient_File()); $this->_client = Zend_Feed::getHttpClient(); $this->_feedDir = 'Zend/Feed/_files'; }
/** * 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); }
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'); }