readFile() public static method

Read a feed from $filename
public static readFile ( string $filename ) : Horde_Feed_Base
$filename string The location of the feed file on an accessible filesystem or through an available stream wrapper.
return Horde_Feed_Base
Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
 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"');
 }
Ejemplo n.º 3
0
 public function testGroupedBlogrolls()
 {
     $feed = Horde_Feed::readFile($this->_feedDir . 'MySubscriptionsGrouped.opml');
 }
Ejemplo n.º 4
0
 public function testCount()
 {
     $f = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeed.xml');
     $this->assertEquals($f->count(), 2, 'Feed count should be 2');
 }
Ejemplo n.º 5
0
#!/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);
Ejemplo n.º 6
0
 /**
  * @dataProvider getLexicon
  */
 public function testParse($file)
 {
     $feed = Horde_Feed::readFile($file);
     $this->assertGreaterThan(0, count($feed));
 }
Ejemplo n.º 7
0
 public function setUp()
 {
     $this->feed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeed.xml');
     $this->nsfeed = Horde_Feed::readFile(__DIR__ . '/fixtures/TestAtomFeedNamespaced.xml');
 }