From 45772748d323178b744c6798947959503e122891 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 26 Aug 2009 21:10:58 +0000 Subject: [PATCH] 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 --- code/CMSMenu.php | 7 ++++++- tests/ModelAdminTest.php | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/CMSMenu.php b/code/CMSMenu.php index 5c97ac2e..4a5b5e1e 100644 --- a/code/CMSMenu.php +++ b/code/CMSMenu.php @@ -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; } diff --git a/tests/ModelAdminTest.php b/tests/ModelAdminTest.php index 91990bc3..d043800e 100644 --- a/tests/ModelAdminTest.php +++ b/tests/ModelAdminTest.php @@ -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(