Skip to content

Commit

Permalink
Add support for OPML categories (thanks to @Tabrisange)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frédéric Guillot committed Aug 15, 2013
1 parent eb5789b commit 062a0ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/PicoFeed/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public function parseEntries($tree)
else if ((isset($item['text']) || isset($item['title'])) && isset($item['xmlUrl'])) {

$entry = new \StdClass;
$entry->category = isset($tree['title']) ? (string) $tree['title'] : (string) $tree['text'];
$entry->title = isset($item['title']) ? (string) $item['title'] : (string) $item['text'];
$entry->feed_url = (string) $item['xmlUrl'];
$entry->site_url = isset($item['htmlUrl']) ? (string) $item['htmlUrl'] : $entry->feed_url;
Expand Down
3 changes: 3 additions & 0 deletions tests/ImportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function testGoogleReader()
$entries = $import->execute();

$this->assertEquals(22, count($entries));
$this->assertEquals('Code', $entries[21]->category);
$this->assertEquals('Vimeo / CocoaheadsRNS', $entries[21]->title);
$this->assertEquals('http://vimeo.com/cocoaheadsrns/videos/rss', $entries[21]->feed_url);
$this->assertEquals('http://vimeo.com/cocoaheadsrns/videos', $entries[21]->site_url);
Expand All @@ -36,6 +37,7 @@ public function testTinyTinyRss()
$entries = $import->execute();

$this->assertEquals(2, count($entries));
$this->assertEquals('coding', $entries[1]->category);
$this->assertEquals('Planète jQuery', $entries[1]->title);
$this->assertEquals('http://feeds.feedburner.com/PlaneteJqueryFr', $entries[1]->feed_url);
$this->assertEquals('http://planete-jquery.fr', $entries[1]->site_url);
Expand All @@ -48,6 +50,7 @@ public function testNewsBeuter()
$entries = $import->execute();

$this->assertEquals(35, count($entries));
$this->assertEquals('', $entries[1]->category);
$this->assertEquals('code.flickr.com', $entries[1]->title);
$this->assertEquals('http://code.flickr.net/feed/', $entries[1]->feed_url);
$this->assertEquals('http://code.flickr.net', $entries[1]->site_url);
Expand Down

0 comments on commit 062a0ab

Please sign in to comment.