diff --git a/code/GoogleSitemap.php b/code/GoogleSitemap.php index d56e4e8..8698993 100644 --- a/code/GoogleSitemap.php +++ b/code/GoogleSitemap.php @@ -93,6 +93,13 @@ class GoogleSitemap extends Controller { return isset(self::$dataobjects[$className]); } + /** + * Clears registered dataobjects. Useful for unit tests. + */ + public static function clear_registered_dataobjects() { + self::$dataobjects = array(); + } + /** * Returns a list containing each viewable {@link DataObject} instance of * the registered class names. diff --git a/tests/GoogleSitemapTest.php b/tests/GoogleSitemapTest.php index 97d2846..697969d 100644 --- a/tests/GoogleSitemapTest.php +++ b/tests/GoogleSitemapTest.php @@ -22,6 +22,12 @@ class GoogleSitemapTest extends FunctionalTest { } } + public function tearDown() { + parent::tearDown(); + + GoogleSitemap::clear_registered_dataobjects(); + } + public function testItems() { $sitemap = new GoogleSitemap();