mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
05b4a2313e
commit
4c71c667e3
@ -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();
|
||||
|
||||
|
@ -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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**#@+
|
||||
|
Loading…
Reference in New Issue
Block a user