BUGFIX Implementing TestOnly interface in ModelAdminTest to avoid having it included automatically in CMSMenu and hence breaking other tests like LeftAndMainTest.

ENHANCEMENT Filtering out TestOnly classes in CMSMenu::get_cms_classes()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@85281 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-08-26 21:10:58 +00:00
parent 98ba54ec91
commit 45772748d3
2 changed files with 7 additions and 2 deletions

View File

@ -280,10 +280,15 @@ class CMSMenu extends Object implements IteratorAggregate, i18nEntityProvider
foreach($subClasses as $key => $className) {
// Remove abstract classes and LeftAndMain
$classReflection = new ReflectionClass($className);
if(!$classReflection->isInstantiable() || 'LeftAndMain' == $className) {
if(
!$classReflection->isInstantiable()
|| 'LeftAndMain' == $className
|| ClassInfo::classImplements($className, 'TestOnly')
) {
unset($subClasses[$key]);
}
}
return $subClasses;
}

View File

@ -11,7 +11,7 @@ class ModelAdminTest extends FunctionalTest {
}
}
class ModelAdminTest_Admin extends ModelAdmin {
class ModelAdminTest_Admin extends ModelAdmin implements TestOnly {
static $url_segment = 'testadmin';
public static $managed_models = array(