Author: as
Date: Fri Feb 22 15:09:22 2008
New Revision: 7434
Log:
- Added some more tests for undefined and unsupported modules.
- Fixed the broken isset in ezcFeed.
Modified:
trunk/Feed/src/feed.php
trunk/Feed/tests/feed_test.php
Modified: trunk/Feed/src/feed.php
==============================================================================
--- trunk/Feed/src/feed.php [iso-8859-1] (original)
+++ trunk/Feed/src/feed.php [iso-8859-1] Fri Feb 22 15:09:22 2008
@@ -465,6 +465,8 @@
}
}
}
+
+ throw new ezcFeedUnsupportedModuleException( $property );
}
/**
@@ -507,7 +509,7 @@
case 'updated':
case 'webMaster':
$value = $this->feedProcessor->get( $name );
- return ( $value === null );
+ return ( $value !== null );
default:
$supportedModules = ezcFeed::getSupportedModules();
@@ -516,6 +518,8 @@
return $this->hasModule( $name );;
}
}
+
+ return false;
}
/**
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 15:09:22 2008
@@ -224,6 +224,42 @@
$this->assertEquals( 'application/atom+xml', $feed->getContentType() );
}
+ public function testParseAtomUnsupportedModule()
+ {
+ $dot = DIRECTORY_SEPARATOR;
+ $file = dirname( __FILE__ ) .
"{$dot}atom{$dot}data{$dot}atom_example_from_specs.xml";
+
+ $feed = ezcFeed::parse( $file );
+
+ try
+ {
+ $module = $feed->unsupported_module;
+ $this->fail( 'Expected exception not thrown' );
+ }
+ catch ( ezcFeedUnsupportedModuleException $e )
+ {
+ $this->assertEquals( "The module 'unsupported_module' is not
supported.", $e->getMessage() );
+ }
+ }
+
+ public function testParseAtomUndefinedModule()
+ {
+ $dot = DIRECTORY_SEPARATOR;
+ $file = dirname( __FILE__ ) .
"{$dot}atom{$dot}data{$dot}atom_example_from_specs.xml";
+
+ $feed = ezcFeed::parse( $file );
+
+ try
+ {
+ $module = $feed->iTunes;
+ $this->fail( 'Expected exception not thrown' );
+ }
+ catch ( ezcFeedUndefinedModuleException $e )
+ {
+ $this->assertEquals( "The module 'iTunes' is not defined yet.",
$e->getMessage() );
+ }
+ }
+
public function testParseAtom1()
{
$dot = DIRECTORY_SEPARATOR;
@@ -233,6 +269,8 @@
$this->assertEquals( 'atom', $feed->getFeedType() );
$this->assertEquals( 'application/atom+xml', $feed->getContentType() );
+ $this->assertEquals( false, isset( $feed->skipDays ) );
+ $this->assertEquals( false, isset( $feed->unsupportedModule ) );
}
public function testParseAtom2()
@@ -289,6 +327,9 @@
$this->assertEquals( 'rss2', $feed->getFeedType() );
$this->assertEquals( 'LibriVox Audiobooks', $feed->title->__toString()
);
+
+ $modules = $feed->getModules();
+ $this->assertEquals( true, isset( $modules['iTunes'] ) );
}
public function testParseRss2Podcast2()
--
svn-components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/svn-components