Author: as Date: Tue Nov 20 13:41:29 2007 New Revision: 6773 Log: - Fixed $feed->items expression for ATOM feeds.
Added: trunk/Feed/tests/atom/data/atom_multiple_entries.xml Modified: trunk/Feed/src/processors/atom.php trunk/Feed/tests/feed_test.php Modified: trunk/Feed/src/processors/atom.php ============================================================================== --- trunk/Feed/src/processors/atom.php [iso-8859-1] (original) +++ trunk/Feed/src/processors/atom.php [iso-8859-1] Tue Nov 20 13:41:29 2007 @@ -262,7 +262,8 @@ 'ELEMENTS_MAP' => array( 'image' => 'logo', 'copyright' => 'rights', 'description' => 'subtitle', - 'item' => 'entry' ), + 'item' => 'entry', + 'items' => 'entries' ), ); /** Added: trunk/Feed/tests/atom/data/atom_multiple_entries.xml ============================================================================== --- trunk/Feed/tests/atom/data/atom_multiple_entries.xml (added) +++ trunk/Feed/tests/atom/data/atom_multiple_entries.xml [iso-8859-1] Tue Nov 20 13:41:29 2007 @@ -1,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<feed xmlns="http://www.w3.org/2005/Atom"> + + <title>Example Feed</title> + <subtitle>A subtitle.</subtitle> + <link href="http://example.org/feed/" rel="self"/> + <link href="http://example.org/"/> + <updated>2003-12-13T18:30:02Z</updated> + <author> + <name>John Doe</name> + <email>[EMAIL PROTECTED]</email> + </author> + <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id> + + <entry> + <title>Atom-Powered Robots Run Amok 1</title> + <link href="http://example.org/2003/12/13/atom03"/> + <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + <updated>2003-12-13T18:30:02Z</updated> + <summary>Some text.</summary> + </entry> + + <entry> + <title>Atom-Powered Robots Run Amok 2</title> + <link href="http://example.org/2003/12/13/atom03"/> + <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> + <updated>2003-12-13T18:30:02Z</updated> + <summary>Some text.</summary> + </entry> + +</feed> Modified: trunk/Feed/tests/feed_test.php ============================================================================== --- trunk/Feed/tests/feed_test.php [iso-8859-1] (original) +++ trunk/Feed/tests/feed_test.php [iso-8859-1] Tue Nov 20 13:41:29 2007 @@ -137,7 +137,7 @@ } } - public function testParseAtom() + public function testParseAtom1() { $dot = DIRECTORY_SEPARATOR; $file = dirname( __FILE__ ) . "{$dot}atom{$dot}data{$dot}atom_example_from_specs.xml"; @@ -145,6 +145,29 @@ $feed = ezcFeed::parse( $file ); $this->assertEquals( 'atom', $feed->getFeedType() ); + } + + public function testParseAtom2() + { + $dot = DIRECTORY_SEPARATOR; + $file = dirname( __FILE__ ) . "{$dot}atom{$dot}data{$dot}atom_multiple_entries.xml"; + + $feed = ezcFeed::parse( $file ); + + $this->assertEquals( 'atom', $feed->getFeedType() ); + $items = $feed->items; + $expectedTitles = array( + 'Atom-Powered Robots Run Amok 1', + 'Atom-Powered Robots Run Amok 2', + ); + + $titles = array(); + foreach ( $items as $item ) + { + $titles[] = $item->title->__toString(); + } + + $this->assertEquals( $expectedTitles, $titles ); } public function testParseRss1() -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components