mirror of
https://github.com/wilr/silverstripe-googlesitemaps.git
synced 2024-10-22 11:05:48 +02:00
FIX: resolve test errors
This commit is contained in:
parent
41ce3396fa
commit
079b949bf2
@ -93,6 +93,15 @@ class GoogleSitemap extends Controller {
|
||||
return isset(self::$dataobjects[$className]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters a class from the sitemap. Mostly used for the test suite
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
public static function unregister_dataobject($className) {
|
||||
unset(self::$dataobjects[$className]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list containing each viewable {@link DataObject} instance of
|
||||
* the registered class names.
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @todo improve tests to be more robust when adding custom behaviours
|
||||
* @package googlesitemaps
|
||||
* @subpackage tests
|
||||
*/
|
||||
@ -20,6 +21,10 @@ class GoogleSitemapTest extends FunctionalTest {
|
||||
if(class_exists('Page')) {
|
||||
$this->loadFixture('googlesitemaps/tests/GoogleSitemapPageTest.yml');
|
||||
}
|
||||
|
||||
GoogleSitemap::unregister_dataobject('GoogleSitemapTest_DataObject');
|
||||
GoogleSitemap::unregister_dataobject('GoogleSitemapTest_OtherDataObject');
|
||||
GoogleSitemap::unregister_dataobject('GoogleSitemapTest_UnviewableDataObject');
|
||||
}
|
||||
|
||||
public function testItems() {
|
||||
@ -27,7 +32,6 @@ class GoogleSitemapTest extends FunctionalTest {
|
||||
|
||||
// register a DataObject and see if its aded to the sitemap
|
||||
GoogleSitemap::register_dataobject("GoogleSitemapTest_DataObject", '');
|
||||
|
||||
$this->assertEquals(2, $sitemap->Items()->Count());
|
||||
|
||||
GoogleSitemap::register_dataobject("GoogleSitemapTest_OtherDataObject");
|
||||
@ -43,7 +47,6 @@ class GoogleSitemapTest extends FunctionalTest {
|
||||
}
|
||||
|
||||
$sitemap = new GoogleSitemap();
|
||||
|
||||
$page = $this->objFromFixture('Page', 'Page1');
|
||||
$page->publish('Stage', 'Live');
|
||||
$page->flushCache();
|
||||
@ -52,7 +55,7 @@ class GoogleSitemapTest extends FunctionalTest {
|
||||
$page2->publish('Stage', 'Live');
|
||||
$page2->flushCache();
|
||||
|
||||
$this->assertDOSEquals(array(
|
||||
$this->assertDOSContains(array(
|
||||
array('Title' => 'Testpage1'),
|
||||
array('Title' => 'Testpage2')
|
||||
), $sitemap->Items(), "There should be 2 pages in the sitemap after publishing");
|
||||
|
Loading…
Reference in New Issue
Block a user