summaryrefslogtreecommitdiffstats
path: root/3rdparty/fguillot/picofeed/tests/Rss92ParserTest.php
blob: d6add7f08d1cd15ca0d1edf27261700c6feaac82 (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
<?php

require_once 'lib/PicoFeed/PicoFeed.php';
require_once 'lib/PicoFeed/Parsers/Rss92.php';

use PicoFeed\Parsers\Rss92;

class Rss92ParserTest extends PHPUnit_Framework_TestCase
{
    public function testFormatOk()
    {
        $parser = new Rss92(file_get_contents('tests/fixtures/univers_freebox.xml'));
        $feed = $parser->execute();

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

        $this->assertEquals('Univers Freebox', $feed->title);
        $this->assertEquals('http://www.universfreebox.com', $feed->url);
        $this->assertEquals('http://www.universfreebox.com', $feed->id);
        $this->assertEquals(time(), $feed->date);
        $this->assertEquals(30, count($feed->items));

        $this->assertEquals('Retour de Xavier Niel sur Twitter, « sans initiative privée, pas de révolution #Born2code »', $feed->items[0]->title);
        $this->assertEquals('http://www.universfreebox.com/article20302.html', $feed->items[0]->url);
        $this->assertEquals('4e8596dc', $feed->items[0]->id);
        $this->assertEquals('', $feed->items[0]->author);
    }
}