Beispiel #1
0
 public function testChangeHashAlgo()
 {
     $parser = new Rss20('');
     $this->assertEquals('fb8e20fc2e4c3f248c60c39bd652f3c1347298bb977b8b4d5903b85055620603', $parser->generateId('a', 'b'));
     $parser->setHashAlgo('sha1');
     $this->assertEquals('da23614e02469a0d7c7bd1bdab5c9c474b1904dc', $parser->generateId('a', 'b'));
 }
 public function testFeedsWithInvalidCharacters()
 {
     $parser = new Rss20(file_get_contents('tests/fixtures/lincoln_loop.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $parser = new Rss20(file_get_contents('tests/fixtures/next_inpact_full.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
 }
Beispiel #3
0
 public function testGetTag()
 {
     $parser = new Rss20(file_get_contents('tests/fixtures/podbean.xml'));
     $feed = $parser->execute();
     $this->assertEquals(array('http://aroundthebloc.podbean.com/e/s03e11-finding-nemo-rocco/'), $feed->items[0]->getTag('guid'));
     $this->assertEquals(array('false'), $feed->items[0]->getTag('guid', 'isPermaLink'));
     $this->assertEquals(array('http://aroundthebloc.podbean.com/mf/web/28bcnk/ATBLogo-BlackBackground.png'), $feed->items[0]->getTag('media:content', 'url'));
     $this->assertEquals(array('http://aroundthebloc.podbean.com/e/s03e11-finding-nemo-rocco/feed/'), $feed->items[0]->getTag('wfw:commentRss'));
     $this->assertEquals(array(), $feed->items[0]->getTag('wfw:notExistent'));
     $this->assertCount(7, $feed->items[0]->getTag('itunes:*'));
 }
Beispiel #4
0
 public function testFeedsReportedAsNotWorking()
 {
     $parser = new Rss20(file_get_contents('tests/fixtures/biertaucher.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $this->assertEquals(177, count($feed->items));
     $parser = new Rss20(file_get_contents('tests/fixtures/radio-france.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $this->assertEquals(52, count($feed->items));
     $parser = new Rss20(file_get_contents('tests/fixtures/fanboys.fm_episodes.all.mp3.rss'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $parser = new Rss20(file_get_contents('tests/fixtures/geekstammtisch.de_episodes.mp3.rss'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $this->assertEquals('http://geekstammtisch.de/#GST001', $feed->items[1]->getUrl());
     $parser = new Rss20(file_get_contents('tests/fixtures/lincoln_loop.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $parser = new Rss20(file_get_contents('tests/fixtures/next_inpact_full.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
     $parser = new Rss20(file_get_contents('tests/fixtures/jeux-linux.fr.xml'));
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
 }
Beispiel #5
0
 public function testHTTPEncodingFallbackIsUsed()
 {
     $parser = new Rss20(file_get_contents('tests/fixtures/cercle.psy.xml'), 'iso-8859-1');
     $feed = $parser->execute();
     $this->assertNotEmpty($feed->items);
 }
Beispiel #6
0
 public function testFindItemEnclosure()
 {
     // Test tests covers the preference of <feedburner:origEnclosureLink> over <enclosure> as well
     $parser = new Rss20(file_get_contents('tests/fixtures/rss_20.xml'));
     $feed = $parser->execute();
     $this->assertEquals('https://upload.wikimedia.org/wikipedia/commons/4/41/War-and-peace_1873.gif', $feed->items[0]->getEnclosureUrl());
     // <enclosure>
     $this->assertEquals('image/gif', $feed->items[0]->getEnclosureType());
     $this->assertEquals('https://upload.wikimedia.org/wikipedia/commons/7/7b/Crime_and_Punishment-1.png', $feed->items[1]->getEnclosureUrl());
     // <feedburner:origEnclosureLink>
     $parser = new Rss20(file_get_contents('tests/fixtures/rss_20_empty_item.xml'));
     $feed = $parser->execute();
     $this->assertEquals('', $feed->items[0]->getEnclosureUrl());
     $this->assertEquals('', $feed->items[0]->getEnclosureType());
 }