mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
MINOR Fixed SiteTreeSubsitesTest->testPageTypesBlacklistInClassDropdown() to work with PHP 5.2, and not rely on the Reflection API (broken in 17dde8ff
)
This commit is contained in:
parent
fe25268274
commit
869e90d129
@ -160,21 +160,30 @@ class SiteTreeSubsitesTest extends SapphireTest {
|
|||||||
$s2 = $this->objFromFixture('Subsite','domaintest2');
|
$s2 = $this->objFromFixture('Subsite','domaintest2');
|
||||||
$page = singleton('SiteTree');
|
$page = singleton('SiteTree');
|
||||||
|
|
||||||
$method = new ReflectionMethod($page, 'getClassDropdown');
|
|
||||||
$method->setAccessible(true);
|
|
||||||
|
|
||||||
$s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage';
|
$s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage';
|
||||||
$s1->write();
|
$s1->write();
|
||||||
|
|
||||||
Subsite::changeSubsite($s1);
|
Subsite::changeSubsite($s1);
|
||||||
$this->assertArrayNotHasKey('ErrorPage', $method->invoke($page));
|
$this->assertArrayNotHasKey('ErrorPage',
|
||||||
$this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA', $method->invoke($page));
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', $method->invoke($page));
|
);
|
||||||
|
$this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA',
|
||||||
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
|
);
|
||||||
|
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB',
|
||||||
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
|
);
|
||||||
|
|
||||||
Subsite::changeSubsite($s2);
|
Subsite::changeSubsite($s2);
|
||||||
$this->assertArrayHasKey('ErrorPage', $method->invoke($page));
|
$this->assertArrayHasKey('ErrorPage',
|
||||||
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA', $method->invoke($page));
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', $method->invoke($page));
|
);
|
||||||
|
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA',
|
||||||
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
|
);
|
||||||
|
$this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB',
|
||||||
|
$page->getCMSFields()->dataFieldByName('ClassName')->getSource()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testPageTypesBlacklistInCMSMain() {
|
function testPageTypesBlacklistInCMSMain() {
|
||||||
|
Loading…
Reference in New Issue
Block a user