Author: as Date: Fri Feb 22 14:17:55 2008 New Revision: 7433 Log: - Added some more tests for the RSS2 parser.
Modified: trunk/Feed/tests/feed_test.php 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] Fri Feb 22 14:17:55 2008 @@ -170,6 +170,36 @@ } } + public function testParseRss2NoVersion() + { + try + { + $feed = ezcFeed::parseContent( '<?xml version="1.0" encoding="utf-8"?><rss><channel><title>RSS no version</title><item><title>Item no version</title></item></channel></rss>' ); + $this->fail( 'Expected exception not thrown' ); + } + catch ( ezcFeedCanNotParseException $e ) + { + $expected = "' could not be parsed: Feed type not recognized."; + $result = substr( $e->getMessage(), strlen( $e->getMessage() ) - 48 ); + $this->assertEquals( $expected, $result ); + } + } + + public function testParseRss2UnsupportedVersion() + { + try + { + $feed = ezcFeed::parseContent( '<?xml version="1.0" encoding="utf-8"?><rss version="unsupported version"><channel><title>RSS unsupported version</title><item><title>Item unsupported version</title></item></channel></rss>' ); + $this->fail( 'Expected exception not thrown' ); + } + catch ( ezcFeedCanNotParseException $e ) + { + $expected = "' could not be parsed: Feed type not recognized."; + $result = substr( $e->getMessage(), strlen( $e->getMessage() ) - 48 ); + $this->assertEquals( $expected, $result ); + } + } + public function testParseModuleNotRecognized() { $feed = ezcFeed::parseContent( '<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><unsupported_module:element>Content</unsupported_module:element></feed>' ); -- svn-components mailing list svn-components@lists.ez.no http://lists.ez.no/mailman/listinfo/svn-components