BUGFIX Fixed SiteTree::page_type_classes() to exclude 'SiteTree' even if on array position 0 - slight difference in return values from Postgres to MySQL (fixes #5336)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@102074 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2010-04-05 20:44:51 +00:00 committed by Sam Minnee
parent 05b4a2313e
commit 4c71c667e3
2 changed files with 9 additions and 1 deletions

View File

@ -301,7 +301,9 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
*/
public static function page_type_classes() {
$classes = ClassInfo::getValidSubClasses();
if($baseClassIndex = array_search('SiteTree', $classes)) unset($classes[$baseClassIndex]);
$baseClassIndex = array_search('SiteTree', $classes);
if($baseClassIndex !== FALSE) unset($classes[$baseClassIndex]);
$kill_ancestors = array();

View File

@ -685,6 +685,12 @@ class SiteTreeTest extends SapphireTest {
}
function testPageTypeClasses() {
$classes = SiteTree::page_type_classes();
$this->assertNotContains('SiteTree', $classes, 'Page types do not include base class');
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
}
}
/**#@+