public function testNotAFeed() { try { $feed = Horde_Feed::readFile($this->_feedDir . 'NotAFeed.xml'); } catch (Exception $e) { $this->assertInstanceOf('Horde_Feed_Exception', $e); return; } $this->fail('Expected a Horde_Feed_Exception when parsing content that is not a feed of any kind'); }
public function testEntryOnly() { $feed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeedEntryOnly.xml'); $this->assertEquals(1, $feed->count(), 'The entry-only feed should report one entry.'); foreach ($feed as $entry) { } $this->assertEquals('Horde_Feed_Entry_Atom', get_class($entry), 'The single entry should be an instance of Horde_Feed_Entry_Atom'); $this->assertEquals('1', $entry->id(), 'The single entry should have id 1'); $this->assertEquals('Bug', $entry->title(), 'The entry\'s title should be "Bug"'); }
public function testGroupedBlogrolls() { $feed = Horde_Feed::readFile($this->_feedDir . 'MySubscriptionsGrouped.opml'); }
public function testCount() { $f = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeed.xml'); $this->assertEquals($f->count(), 2, 'Feed count should be 2'); }
#!/usr/bin/env php <?php /** * @package Feed */ /* Get a Horde framework include_path set up. */ require 'Horde/Autoloader.php'; $p = new Horde_Argv_Parser(array('usage' => "%prog opml_url\n\nExample:\n%prog subscriptions.opml")); list($values, $args) = $p->parseArgs(); if (count($args) != 1) { $p->printHelp(); exit(1); } $blogroll = Horde_Feed::readFile($args[0]); echo $blogroll->title . "\n\n"; foreach ($blogroll as $blog) { $feed = $blog->getFeed(); echo $feed->title . "\n\n"; foreach ($feed as $entry) { echo "{$entry->title}\n"; } echo "\n\n"; } exit(0);
/** * @dataProvider getLexicon */ public function testParse($file) { $feed = Horde_Feed::readFile($file); $this->assertGreaterThan(0, count($feed)); }
public function setUp() { $this->feed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeed.xml'); $this->nsfeed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeedNamespaced.xml'); }