hello feed
http://meerkat.oreillynet.com
Meerkat: An Open Wire Service
-
XML: A Disruptive Technology
http://c.moreover.com/click/here.pl?r123
desc
XML;
$sut = new \FeedParser();
$feed = $sut->parseFeed($xml);
$this->assertSame('hello feed', $feed['title']);
$this->assertSame('http://meerkat.oreillynet.com', $feed['uri']);
$this->assertSame(null, $feed['icon']);
$item = $feed['items'][0];
$this->assertSame('XML: A Disruptive Technology', $item['title']);
$this->assertSame('http://c.moreover.com/click/here.pl?r123', $item['uri']);
$this->assertSame('desc', $item['content']);
}
public function testRss2()
{
$xml = <<
hello feed
https://example.com/
https://example.com/2.ico
-
hello world
https://example.com/1
desc2
Tue, 26 Apr 2022 00:00:00 +0200
root
XML;
$sut = new \FeedParser();
$feed = $sut->parseFeed($xml);
$this->assertSame('hello feed', $feed['title']);
$this->assertSame('https://example.com/', $feed['uri']);
$this->assertSame('https://example.com/2.ico', $feed['icon']);
$item = $feed['items'][0];
$this->assertSame('hello world', $item['title']);
$this->assertSame('https://example.com/1', $item['uri']);
$this->assertSame(1650924000, $item['timestamp']);
$this->assertSame('root', $item['author']);
$this->assertSame('desc2', $item['content']);
$this->assertSame(['https://example.com/1.png'], $item['enclosures']);
}
public function testAtom()
{
$xml = <<
hello feed
https://example.com/2.ico
hello world
root
html
2015-11-05T14:38:49+01:00
XML;
$sut = new \FeedParser();
$feed = $sut->parseFeed($xml);
$this->assertSame('hello feed', $feed['title']);
$this->assertSame('https://example.com/1', $feed['uri']);
$this->assertSame('https://example.com/2.ico', $feed['icon']);
$item = $feed['items'][0];
$this->assertSame('hello world', $item['title']);
$this->assertSame('https://example.com/1', $item['uri']);
$this->assertSame(1446730729, $item['timestamp']);
$this->assertSame('root', $item['author']);
$this->assertSame('html', $item['content']);
}
}