From 869e90d12935d85144385bf37daadf7c37ba1755 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 15 Nov 2011 14:15:28 +0100 Subject: [PATCH] MINOR Fixed SiteTreeSubsitesTest->testPageTypesBlacklistInClassDropdown() to work with PHP 5.2, and not rely on the Reflection API (broken in 17dde8ff) --- tests/SiteTreeSubsitesTest.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/SiteTreeSubsitesTest.php b/tests/SiteTreeSubsitesTest.php index 0d1773d..d38a536 100644 --- a/tests/SiteTreeSubsitesTest.php +++ b/tests/SiteTreeSubsitesTest.php @@ -160,21 +160,30 @@ class SiteTreeSubsitesTest extends SapphireTest { $s2 = $this->objFromFixture('Subsite','domaintest2'); $page = singleton('SiteTree'); - $method = new ReflectionMethod($page, 'getClassDropdown'); - $method->setAccessible(true); - $s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage'; $s1->write(); Subsite::changeSubsite($s1); - $this->assertArrayNotHasKey('ErrorPage', $method->invoke($page)); - $this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA', $method->invoke($page)); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', $method->invoke($page)); + $this->assertArrayNotHasKey('ErrorPage', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); + $this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); Subsite::changeSubsite($s2); - $this->assertArrayHasKey('ErrorPage', $method->invoke($page)); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA', $method->invoke($page)); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', $method->invoke($page)); + $this->assertArrayHasKey('ErrorPage', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', + $page->getCMSFields()->dataFieldByName('ClassName')->getSource() + ); } function testPageTypesBlacklistInCMSMain() {