<link href="http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8"/>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">Millenium Spire, Dublin
- <div class="geo">Geo coordinates:
+ <div class="geo">Geo coordinates:
<abbr class="latitude" title="53.349441">53.349441</abbr>
<abbr class="longitude" title="-6.260282">-6.260282</abbr>
</div>
$parser->parse($fake_atom_file);
$this->assertFalse(count($parser->feed) == 0);
-
+
$current_feed = $parser->feed[0];
$this->assertEquals("This is a fake feed", $current_feed["title"]);
-
+
$this->assertFalse(count($current_feed["links"]) == 0);
$this->assertEquals("http://www.phpwiki.org/fakeurl", $current_feed["links"][0]["href"]);
$this->assertEquals("Cool feed", $current_feed["subtitle"]);
$this->assertEquals("2010-05-15T01:00:00Z", $current_feed["updated"]);
-
+
$this->assertFalse(count($current_feed["authors"]) == 0);
-
+
$current_author = $current_feed["authors"][0];
$this->assertEquals("Sébastien Le Callonnec", $current_author["name"]);
$this->assertEquals("slc_ie@yahoo.ie", $current_author["email"]);
-
+
$this->assertFalse(count($parser->entries) == 0);
-
+
$current_entry = $parser->entries[0];
$this->assertEquals("Foobar Éire", $current_entry["title"]);
$this->assertEquals("http://maps.google.com/maps?f=q&sll=53.125728,-6.068907&ie=UTF8", $current_entry["links"][0]["href"]);
$this->assertEquals("2010-05-15T01:00:00Z", $current_entry["updated"]);
$this->assertEquals("2010-05-15T01:00:00Z", $current_entry["published"]);
$this->assertEquals("tag:www.phpwiki.org,2010-05-15:/fakeurl/20100515223621", $current_entry["id"]);
-
+
$payload =<<<CONTENT
<div xmlns="http://www.w3.org/1999/xhtml">Millenium Spire, Dublin
- <div class="geo">Geo coordinates:
+ <div class="geo">Geo coordinates:
<abbr class="latitude" title="53.349441">53.349441</abbr>
<abbr class="longitude" title="-6.260282">-6.260282</abbr>
</div>
CONTENT;
$this->assertEquals($payload, $current_entry["content"]);
}
-
+
function testExtensiveAtomExampleFromRFC4287() {
$fake_atom_file = <<<ATOM
<?xml version="1.0" encoding="utf-8"?>
<updated>2005-07-31T12:29:29Z</updated>
<id>tag:example.org,2003:3</id>
- <link rel="alternate" type="text/html"
+ <link rel="alternate" type="text/html"
hreflang="en" href="http://example.org/"/>
- <link rel="self" type="application/atom+xml"
+ <link rel="self" type="application/atom+xml"
href="http://example.org/feed.atom"/>
<rights>Copyright (c) 2003, Mark Pilgrim</rights>
</generator>
<entry>
<title>Atom draft-07 snapshot</title>
- <link rel="alternate" type="text/html"
+ <link rel="alternate" type="text/html"
href="http://example.org/2005/04/02/atom"/>
<link rel="enclosure" type="audio/mpeg" length="1337"
<name>Joe Gregorio</name>
</contributor>
- <content type="xhtml" xml:lang="en"
+ <content type="xhtml" xml:lang="en"
xml:base="http://diveintomark.org/">
<div xmlns="http://www.w3.org/1999/xhtml">
<p><i>[Update: The Atom draft is finished.]</i></p>
$parser->parse($fake_atom_file);
$this->assertFalse(count($parser->feed) == 0);
-
+
$current_feed = $parser->feed[0];
$this->assertEquals("dive into mark", $current_feed["title"]);
$this->assertEquals("Copyright (c) 2003, Mark Pilgrim", $current_feed["rights"]);
$this->assertEquals("2005-07-31T12:29:29Z", $current_feed["updated"]);
$this->assertEquals("tag:example.org,2003:3", $current_feed["id"]);
$this->assertEquals("Example Toolkit", $current_feed["generator"]);
-
+
$this->assertTrue(count($current_feed["authors"]) == 0);
$this->assertTrue(count($current_feed["contributors"]) == 0);
-
+
$this->assertFalse(count($parser->entries) == 0);
-
+
$current_entry = $parser->entries[0];
$this->assertEquals("Atom draft-07 snapshot", $current_entry["title"]);
$this->assertEquals("2005-07-31T12:29:29Z", $current_entry["updated"]);
$this->assertEquals("2003-12-13T08:29:29-04:00", $current_entry["published"]);
$this->assertEquals("tag:example.org,2003:3.2397", $current_entry["id"]);
$this->assertEquals(2, count($current_entry["links"]));
-
+
$this->assertTrue(count($current_entry["authors"]) == 1);
$this->assertTrue(count($current_entry["contributors"]) == 2);
-
+
$current_author = $current_entry["authors"][0];
$this->assertEquals("Mark Pilgrim", $current_author["name"]);
$this->assertEquals("f8dy@example.com", $current_author["email"]);
-
+
$first_contributor = $current_entry["contributors"][0];
$second_contributor = $current_entry["contributors"][1];
-
+
$this->assertEquals("Sam Ruby", $first_contributor["name"]);
$this->assertEquals("Joe Gregorio", $second_contributor["name"]);
-
+
$first_link = $current_entry["links"][0];
$this->assertEquals("alternate", $first_link["rel"]);
$this->assertEquals("text/html", $first_link["type"]);
$this->assertEquals("http://example.org/2005/04/02/atom", $first_link["href"]);
-
+
$second_link = $current_entry["links"][1];
$this->assertEquals("enclosure", $second_link["rel"]);
$this->assertEquals("audio/mpeg", $second_link["type"]);
$this->assertEquals("1337", $second_link["length"]);
$this->assertEquals("http://example.org/audio/ph34r_my_podcast.mp3", $second_link["href"]);
-
+
$payload = <<<CONTENT
<div xmlns="http://www.w3.org/1999/xhtml">
<p><i>[Update: The Atom draft is finished.]</i></p>