summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests/Parser/Rss91ParserTest.php
blob: 8f10f2ea5dc725d741d926de3725204fc462138c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace PicoFeed\Parser;

use PHPUnit_Framework_TestCase;


class Rss91ParserTest extends PHPUnit_Framework_TestCase
{
    public function testFormatOk()
    {
        $parser = new Rss91(file_get_contents('tests/fixtures/rss_0.91.xml'));
        $feed = $parser->execute();

        $this->assertNotFalse($feed);
        $this->assertNotEmpty($feed->items);

        $this->assertEquals('WriteTheWeb', $feed->getTitle());
        $this->assertEquals('http://writetheweb.com', $feed->getUrl());
        $this->assertEquals('http://writetheweb.com', $feed->getId());
        $this->assertEquals(time(), $feed->getDate());
        $this->assertEquals(6, count($feed->items));

        $this->assertEquals('Giving the world a pluggable Gnutella', $feed->items[0]->getTitle());
        $this->assertEquals('http://writetheweb.com/read.php?item=24', $feed->items[0]->getUrl());
        $this->assertEquals('085a9133a75542f878fa73ee2afbb6a2350b6c4fb125e6d8ca09478c47702111', $feed->items[0]->getId());
        $this->assertEquals(time(), $feed->items[0]->getDate());
        $this->assertEquals('webmaster@writetheweb.com', $feed->items[0]->getAuthor());
        $this->assertTrue(strpos($feed->items[1]->getContent(), '<p>After a period of dormancy') === 0);
    }
}