From 997459caf3bc835065b4afa17fc7c43e050cea6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Werner=20M=2E=20Krau=C3=9F?= Date: Tue, 30 May 2017 17:35:02 +0200 Subject: [PATCH] Get some more tests working Updating config and i18n calls --- _config/extensions.yml | 4 - code/extensions/GroupSubsites.php | 5 +- code/model/Subsite.php | 4 +- code/pages/SubsitesVirtualPage.php | 6 +- tests/php/GroupSubsitesTest.php | 4 +- tests/php/LeftAndMainSubsitesTest.php | 4 +- tests/php/SiteConfigSubsitesTest.php | 1 - tests/php/SiteTreeSubsitesTest.php | 270 ++++++++++++----------- tests/php/SubsiteAdminFunctionalTest.php | 4 +- tests/php/SubsiteTest.php | 1 + tests/php/SubsitesVirtualPageTest.php | 3 +- tests/{ => php}/testscript-test-file.pdf | Bin 12 files changed, 161 insertions(+), 145 deletions(-) rename tests/{ => php}/testscript-test-file.pdf (100%) diff --git a/_config/extensions.yml b/_config/extensions.yml index 1f0d3eed..71b48f62 100644 --- a/_config/extensions.yml +++ b/_config/extensions.yml @@ -36,10 +36,6 @@ SilverStripe\SiteConfig\SiteConfig: extensions: - SilverStripe\Subsites\Extensions\SiteConfigSubsites -SilverStripe\Reports\Report: - extensions: - - SilverStripe\Subsites\SubsiteReportWrapper - SilverStripe\AssetAdmin\Controller\AssetAdmin: extensions: - SilverStripe\Subsites\Extensions\SubsiteMenuExtension diff --git a/code/extensions/GroupSubsites.php b/code/extensions/GroupSubsites.php index 3c96d83f..41667415 100644 --- a/code/extensions/GroupSubsites.php +++ b/code/extensions/GroupSubsites.php @@ -42,8 +42,11 @@ class GroupSubsites extends DataExtension implements PermissionProvider */ public function requireDefaultRecords() { + if (!$this->owner) { + return; + } // Migration for Group.SubsiteID data from when Groups only had a single subsite - $schema = $this->owner->getSchema(); + $schema = $this->owner::getSchema(); $groupFields = DB::field_list($schema->tableName(Group::class)); // Detection of SubsiteID field is the trigger for old-style-subsiteID migration diff --git a/code/model/Subsite.php b/code/model/Subsite.php index e1204bb0..201c8aad 100644 --- a/code/model/Subsite.php +++ b/code/model/Subsite.php @@ -186,8 +186,8 @@ public static function changeSubsite($subsite) Session::set('SubsiteID', (int)$subsiteID); // Set locale - if (is_object($subsite) && $subsite->Language != '') { - $locale = i18n::get_locale_from_lang($subsite->Language); + if (is_object($subsite) && $subsite->Language !== '') { + $locale = (new IntlLocales())->localeFromLang($subsite->Language); if ($locale) { i18n::set_locale($locale); } diff --git a/code/pages/SubsitesVirtualPage.php b/code/pages/SubsitesVirtualPage.php index 85a2a297..b8fc36ae 100644 --- a/code/pages/SubsitesVirtualPage.php +++ b/code/pages/SubsitesVirtualPage.php @@ -100,7 +100,7 @@ public function getCMSFields() TextareaField::create( 'CustomMetaKeywords', $this->fieldLabel('CustomMetaTitle') - )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + )->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'MetaKeywords' ); $fields->addFieldToTab( @@ -108,7 +108,7 @@ public function getCMSFields() TextareaField::create( 'CustomMetaDescription', $this->fieldLabel('CustomMetaTitle') - )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + )->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'MetaDescription' ); $fields->addFieldToTab( @@ -116,7 +116,7 @@ public function getCMSFields() TextField::create( 'CustomExtraMeta', $this->fieldLabel('CustomMetaTitle') - )->setDescription(_t('SubsitesVirtualPage.OverrideNote')), + )->setDescription(_t('SubsitesVirtualPage.OverrideNote', 'Overrides inherited value from the source')), 'ExtraMeta' ); diff --git a/tests/php/GroupSubsitesTest.php b/tests/php/GroupSubsitesTest.php index 3ee4052c..73b30952 100644 --- a/tests/php/GroupSubsitesTest.php +++ b/tests/php/GroupSubsitesTest.php @@ -14,8 +14,8 @@ class GroupSubsitesTest extends BaseSubsiteTest protected $requireDefaultRecordsFrom = [GroupSubsites::class]; public function testTrivialFeatures() { - $this->assertTrue(is_array(singleton('GroupSubsites')->extraStatics())); - $this->assertTrue(is_array(singleton('GroupSubsites')->providePermissions())); + $this->assertTrue(is_array(singleton(GroupSubsites::class)->extraStatics())); + $this->assertTrue(is_array(singleton(GroupSubsites::class)->providePermissions())); $this->assertTrue(singleton(Group::class)->getCMSFields() instanceof FieldList); } diff --git a/tests/php/LeftAndMainSubsitesTest.php b/tests/php/LeftAndMainSubsitesTest.php index e3b1697b..4d714a20 100644 --- a/tests/php/LeftAndMainSubsitesTest.php +++ b/tests/php/LeftAndMainSubsitesTest.php @@ -82,7 +82,7 @@ public function testAccessChecksDontChangeCurrentSubsite() public function testShouldChangeSubsite() { $l = new LeftAndMain(); - Config::inst()->nest(); + Config::nest(); Config::modify()->set(CMSPageEditController::class, 'treats_subsite_0_as_global', false); $this->assertTrue($l->shouldChangeSubsite(CMSPageEditController::class, 0, 5)); @@ -96,6 +96,6 @@ public function testShouldChangeSubsite() $this->assertTrue($l->shouldChangeSubsite(CMSPageEditController::class, 1, 5)); $this->assertFalse($l->shouldChangeSubsite(CMSPageEditController::class, 1, 1)); - Config::inst()->unnest(); + Config::unnest(); } } diff --git a/tests/php/SiteConfigSubsitesTest.php b/tests/php/SiteConfigSubsitesTest.php index 022ca3ef..d2f3e928 100644 --- a/tests/php/SiteConfigSubsitesTest.php +++ b/tests/php/SiteConfigSubsitesTest.php @@ -6,7 +6,6 @@ use SilverStripe\Subsites\Extensions\SiteConfigSubsites; use SilverStripe\Subsites\Model\Subsite; - class SiteConfigSubsitesTest extends BaseSubsiteTest { public static $fixture_file = 'subsites/tests/php/SubsiteTest.yml'; diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index dbb1a303..97337d01 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -2,22 +2,22 @@ namespace SilverStripe\Subsites\Tests; -use SilverStripe\CMS\Model\SiteTree; -use SilverStripe\SiteConfig\SiteConfig; -use SilverStripe\Forms\FieldList; +use Page; +use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\CMS\Model\ErrorPage; -use SilverStripe\Core\Config\Config; -use SilverStripe\Security\Member; -use SilverStripe\Control\Session; +use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Director; -use SilverStripe\CMS\Controllers\CMSMain; +use SilverStripe\Control\Session; +use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; -use SilverStripe\Versioned\Versioned; use SilverStripe\Dev\TestOnly; +use SilverStripe\Forms\FieldList; +use SilverStripe\Security\Member; +use SilverStripe\SiteConfig\SiteConfig; use SilverStripe\Subsites\Extensions\SiteTreeSubsites; use SilverStripe\Subsites\Model\Subsite; use SilverStripe\Subsites\Pages\SubsitesVirtualPage; - +use SilverStripe\Versioned\Versioned; class SiteTreeSubsitesTest extends BaseSubsiteTest { @@ -34,7 +34,8 @@ class SiteTreeSubsitesTest extends BaseSubsiteTest SiteTree::class => ['Translatable'] ]; - public function testPagesInDifferentSubsitesCanShareURLSegment() { + public function testPagesInDifferentSubsitesCanShareURLSegment() + { $subsiteMain = $this->objFromFixture(Subsite::class, 'main'); $subsite1 = $this->objFromFixture(Subsite::class, 'subsite1'); @@ -62,9 +63,10 @@ public function testPagesInDifferentSubsitesCanShareURLSegment() { $this->assertEquals($pageMain->URLSegment, $pageSubsite1->URLSegment, 'Pages in different subsites can share the same URL' ); - } + } - public function testBasicSanity() { + public function testBasicSanity() + { $this->assertTrue(singleton(SiteTree::class)->getSiteConfig() instanceof SiteConfig); // The following assert is breaking in Translatable. $this->assertTrue(singleton(SiteTree::class)->getCMSFields() instanceof FieldList); @@ -72,16 +74,17 @@ public function testBasicSanity() { $this->assertTrue(is_array(singleton(SiteTreeSubsites::class)->extraStatics())); } - public function testErrorPageLocations() { - $subsite1 = $this->objFromFixture(Subsite::class, 'domaintest1'); + public function testErrorPageLocations() + { + $subsite1 = $this->objFromFixture(Subsite::class, 'domaintest1'); - Subsite::changeSubsite($subsite1->ID); - $path = ErrorPage::get_filepath_for_errorcode(500); + Subsite::changeSubsite($subsite1->ID); + $path = ErrorPage::get_filepath_for_errorcode(500); - $static_path = Config::inst()->get(ErrorPage::class, 'static_filepath'); - $expected_path = $static_path . '/error-500-'.$subsite1->domain().'.html'; - $this->assertEquals($expected_path, $path); - } + $static_path = Config::inst()->get(ErrorPage::class, 'static_filepath'); + $expected_path = $static_path . '/error-500-' . $subsite1->domain() . '.html'; + $this->assertEquals($expected_path, $path); + } public function testCanEditSiteTree() { @@ -94,48 +97,49 @@ public function testCanEditSiteTree() $subsite1 = $this->objFromFixture(Subsite::class, 'subsite1'); $subsite2 = $this->objFromFixture(Subsite::class, 'subsite2'); - // Cant pass member as arguments to canEdit() because of GroupSubsites - Session::set("loggedInAs", $admin->ID); - $this->assertTrue( - (bool)$subsite1page->canEdit(), - 'Administrators can edit all subsites' - ); - - // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state - Subsite::changeSubsite($subsite1); - - Session::set("loggedInAs", $subsite1member->ID); - $this->assertTrue( - (bool)$subsite1page->canEdit(), - 'Members can edit pages on a subsite if they are in a group belonging to this subsite' - ); - - Session::set("loggedInAs", $subsite2member->ID); - $this->assertFalse( - (bool)$subsite1page->canEdit(), - 'Members cant edit pages on a subsite if they are not in a group belonging to this subsite' - ); - - // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state - Subsite::changeSubsite(0); - $this->assertFalse( - $mainpage->canEdit(), - 'Members cant edit pages on the main site if they are not in a group allowing this' - ); - } - - /** - * Similar to {@link SubsitesVirtualPageTest->testSubsiteVirtualPageCanHaveSameUrlsegmentAsOtherSubsite()}. - */ - public function testTwoPagesWithSameURLOnDifferentSubsites() { - // Set up a couple of pages with the same URL on different subsites + // Cant pass member as arguments to canEdit() because of GroupSubsites + Session::set("loggedInAs", $admin->ID); + $this->assertTrue( + (bool)$subsite1page->canEdit(), + 'Administrators can edit all subsites' + ); + + // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state + Subsite::changeSubsite($subsite1); + + Session::set("loggedInAs", $subsite1member->ID); + $this->assertTrue( + (bool)$subsite1page->canEdit(), + 'Members can edit pages on a subsite if they are in a group belonging to this subsite' + ); + + Session::set("loggedInAs", $subsite2member->ID); + $this->assertFalse( + (bool)$subsite1page->canEdit(), + 'Members cant edit pages on a subsite if they are not in a group belonging to this subsite' + ); + + // @todo: Workaround because GroupSubsites->augmentSQL() is relying on session state + Subsite::changeSubsite(0); + $this->assertFalse( + $mainpage->canEdit(), + 'Members cant edit pages on the main site if they are not in a group allowing this' + ); + } + + /** + * Similar to {@link SubsitesVirtualPageTest->testSubsiteVirtualPageCanHaveSameUrlsegmentAsOtherSubsite()}. + */ + public function testTwoPagesWithSameURLOnDifferentSubsites() + { + // Set up a couple of pages with the same URL on different subsites $s1 = $this->objFromFixture(Subsite::class, 'domaintest1'); $s2 = $this->objFromFixture(Subsite::class, 'domaintest2'); - $p1 = new SiteTree(); - $p1->Title = $p1->URLSegment = "test-page"; - $p1->SubsiteID = $s1->ID; - $p1->write(); + $p1 = new SiteTree(); + $p1->Title = $p1->URLSegment = "test-page"; + $p1->SubsiteID = $s1->ID; + $p1->write(); $p2 = new SiteTree(); $p2->Title = $p1->URLSegment = "test-page"; @@ -150,48 +154,50 @@ public function testTwoPagesWithSameURLOnDifferentSubsites() { Subsite::changeSubsite($s1); $this->assertEquals($p1->ID, SiteTree::get_by_link('test-page')->ID); - Subsite::changeSubsite($s2); - $this->assertEquals($p2->ID, SiteTree::get_by_link('test-page')->ID); - } + Subsite::changeSubsite($s2); + $this->assertEquals($p2->ID, SiteTree::get_by_link('test-page')->ID); + } - public function testPageTypesBlacklistInClassDropdown() { - $editor = $this->objFromFixture(Member::class, 'editor'); - Session::set("loggedInAs", $editor->ID); + public function testPageTypesBlacklistInClassDropdown() + { + $editor = $this->objFromFixture(Member::class, 'editor'); + Session::set("loggedInAs", $editor->ID); $s1 = $this->objFromFixture(Subsite::class, 'domaintest1'); $s2 = $this->objFromFixture(Subsite::class, 'domaintest2'); - $page = singleton('SiteTree'); - - $s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage'; - $s1->write(); - - Subsite::changeSubsite($s1); - $settingsFields = $page->getSettingsFields()->dataFieldByName('ClassName')->getSource(); - - $this->assertArrayNotHasKey(ErrorPage::class, - $settingsFields - ); - $this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA', - $settingsFields - ); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', - $settingsFields - ); - - Subsite::changeSubsite($s2); - $settingsFields = $page->getSettingsFields()->dataFieldByName('ClassName')->getSource(); - $this->assertArrayHasKey(ErrorPage::class, - $settingsFields - ); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA', - $settingsFields - ); - $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', - $settingsFields - ); - } - - public function testCopyToSubsite() { + $page = singleton(SiteTree::class); + + $s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage'; + $s1->write(); + + Subsite::changeSubsite($s1); + $settingsFields = $page->getSettingsFields()->dataFieldByName('ClassName')->getSource(); + + $this->assertArrayNotHasKey(ErrorPage::class, + $settingsFields + ); + $this->assertArrayNotHasKey('SiteTreeSubsitesTest_ClassA', + $settingsFields + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', + $settingsFields + ); + + Subsite::changeSubsite($s2); + $settingsFields = $page->getSettingsFields()->dataFieldByName('ClassName')->getSource(); + $this->assertArrayHasKey(ErrorPage::class, + $settingsFields + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassA', + $settingsFields + ); + $this->assertArrayHasKey('SiteTreeSubsitesTest_ClassB', + $settingsFields + ); + } + + public function testCopyToSubsite() + { // Remove baseurl if testing in subdir Config::modify()->set(Director::class, 'alternate_base_url', '/'); @@ -214,40 +220,43 @@ public function testCopyToSubsite() { // Staff is shifted to top level and given a unique url segment $domain = $otherSubsite->domain(); - $this->assertEquals('http://'.$domain.'/staff-2/', $staffPage2->AbsoluteLink()); - $this->assertEquals('http://'.$domain.'/contact-us-2/', $contactPage2->AbsoluteLink()); + $this->assertEquals('http://' . $domain . '/staff-2/', $staffPage2->AbsoluteLink()); + $this->assertEquals('http://' . $domain . '/contact-us-2/', $contactPage2->AbsoluteLink()); } - public function testPageTypesBlacklistInCMSMain() { - $editor = $this->objFromFixture(Member::class, 'editor'); - Session::set("loggedInAs", $editor->ID); + public function testPageTypesBlacklistInCMSMain() + { + $editor = $this->objFromFixture(Member::class, 'editor'); + Session::set("loggedInAs", $editor->ID); - $cmsmain = new CMSMain(); + $cmsmain = new CMSMain(); - $s1 = $this->objFromFixture(Subsite::class,'domaintest1'); - $s2 = $this->objFromFixture(Subsite::class,'domaintest2'); + $s1 = $this->objFromFixture(Subsite::class, 'domaintest1'); + $s2 = $this->objFromFixture(Subsite::class, 'domaintest2'); - $s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage'; - $s1->write(); + $s1->PageTypeBlacklist = 'SiteTreeSubsitesTest_ClassA,ErrorPage'; + $s1->write(); - Subsite::changeSubsite($s1); - $hints = Convert::json2array($cmsmain->SiteTreeHints()); - $classes = $hints['Root']['disallowedChildren']; - $this->assertContains(ErrorPage::class, $classes); - $this->assertContains('SiteTreeSubsitesTest_ClassA', $classes); - $this->assertNotContains('SiteTreeSubsitesTest_ClassB', $classes); + Subsite::changeSubsite($s1); + $hints = Convert::json2array($cmsmain->SiteTreeHints()); + $classes = $hints['Root']['disallowedChildren']; + $this->assertContains(ErrorPage::class, $classes); + $this->assertContains('SiteTreeSubsitesTest_ClassA', $classes); + $this->assertNotContains('SiteTreeSubsitesTest_ClassB', $classes); + + Subsite::changeSubsite($s2); + $hints = Convert::json2array($cmsmain->SiteTreeHints()); + $classes = $hints['Root']['disallowedChildren']; + $this->assertNotContains(ErrorPage::class, $classes); + $this->assertNotContains('SiteTreeSubsitesTest_ClassA', $classes); + $this->assertNotContains('SiteTreeSubsitesTest_ClassB', $classes); + } - Subsite::changeSubsite($s2); - $hints = Convert::json2array($cmsmain->SiteTreeHints()); - $classes = $hints['Root']['disallowedChildren']; - $this->assertNotContains(ErrorPage::class, $classes); - $this->assertNotContains('SiteTreeSubsitesTest_ClassA', $classes); - $this->assertNotContains('SiteTreeSubsitesTest_ClassB', $classes); - } /** * Tests that url segments between subsites don't conflict, but do conflict within them */ - public function testValidateURLSegment() { + public function testValidateURLSegment() + { $this->logInWithPermission('ADMIN'); // Saving existing page in the same subsite doesn't change urls $mainHome = $this->objFromFixture('Page', 'home'); @@ -267,7 +276,8 @@ public function testValidateURLSegment() { $subsite1Home->write(); $this->assertEquals('home', $subsite1Home->URLSegment); $subsite1Home->doPublish(); - $subsite1HomeLive = Versioned::get_one_by_stage('Page', 'Live', sprintf('"SiteTree"."ID" = \'%d\'', $subsite1Home->ID)); + $subsite1HomeLive = Versioned::get_one_by_stage('Page', 'Live', + sprintf('"SiteTree"."ID" = \'%d\'', $subsite1Home->ID)); $this->assertEquals('home', $subsite1HomeLive->URLSegment); // Creating a new page in a subsite doesn't conflict with urls in other subsites @@ -280,7 +290,8 @@ public function testValidateURLSegment() { $subsite1NewPage->write(); $this->assertEquals('important-page', $subsite1NewPage->URLSegment); $subsite1NewPage->doPublish(); - $subsite1NewPageLive = Versioned::get_one_by_stage('Page', 'Live', sprintf('"SiteTree"."ID" = \'%d\'', $subsite1NewPage->ID)); + $subsite1NewPageLive = Versioned::get_one_by_stage('Page', 'Live', + sprintf('"SiteTree"."ID" = \'%d\'', $subsite1NewPage->ID)); $this->assertEquals('important-page', $subsite1NewPageLive->URLSegment); // Creating a new page in a subsite DOES conflict with urls in the same subsite @@ -291,7 +302,8 @@ public function testValidateURLSegment() { $subsite1NewPage2->write(); $this->assertEquals('important-page-2', $subsite1NewPage2->URLSegment); $subsite1NewPage2->doPublish(); - $subsite1NewPage2Live = Versioned::get_one_by_stage('Page', 'Live', sprintf('"SiteTree"."ID" = \'%d\'', $subsite1NewPage2->ID)); + $subsite1NewPage2Live = Versioned::get_one_by_stage('Page', 'Live', + sprintf('"SiteTree"."ID" = \'%d\'', $subsite1NewPage2->ID)); $this->assertEquals('important-page-2', $subsite1NewPage2Live->URLSegment); // Original page is left un-modified @@ -303,16 +315,19 @@ public function testValidateURLSegment() { $this->assertEquals('important-page', $mainSubsiteImportantPage->URLSegment); } - public function testCopySubsiteWithChildren() { + public function testCopySubsiteWithChildren() + { $page = $this->objFromFixture('Page', 'about'); $newSubsite = $this->objFromFixture(Subsite::class, 'subsite1'); $moved = $page->duplicateToSubsite($newSubsite->ID, true); $this->assertEquals($moved->SubsiteID, $newSubsite->ID, 'Ensure returned records are on new subsite'); - $this->assertEquals($moved->AllChildren()->count(), $page->AllChildren()->count(), 'All pages are copied across'); + $this->assertEquals($moved->AllChildren()->count(), $page->AllChildren()->count(), + 'All pages are copied across'); } - public function testCopySubsiteWithoutChildren() { + public function testCopySubsiteWithoutChildren() + { $page = $this->objFromFixture('Page', 'about'); $newSubsite = $this->objFromFixture(Subsite::class, 'subsite2'); @@ -326,6 +341,7 @@ public function testCopySubsiteWithoutChildren() { class SiteTreeSubsitesTest_ClassA extends SiteTree implements TestOnly { } + class SiteTreeSubsitesTest_ClassB extends SiteTree implements TestOnly { } diff --git a/tests/php/SubsiteAdminFunctionalTest.php b/tests/php/SubsiteAdminFunctionalTest.php index a6a31ebe..5def7771 100644 --- a/tests/php/SubsiteAdminFunctionalTest.php +++ b/tests/php/SubsiteAdminFunctionalTest.php @@ -78,7 +78,7 @@ public function testAdminIsRedirectedToObjectsSubsite() $mainSubsitePage = $this->objFromFixture('Page', 'mainSubsitePage'); $subsite1Home = $this->objFromFixture('Page', 'subsite1_home'); - Config::inst()->nest(); + Config::nest(); Config::modify()->set(CMSPageEditController::class, 'treats_subsite_0_as_global', false); Subsite::changeSubsite(0); @@ -96,7 +96,7 @@ public function testAdminIsRedirectedToObjectsSubsite() $this->assertNotEquals(Subsite::currentSubsiteID(), $mainSubsitePage->SubsiteID, 'Loading a main-site object does not change the subsite if configured with treats_subsite_0_as_global'); $this->assertRegExp("#^admin/pages.*#", $this->mainSession->lastUrl(), 'Lands on the correct section'); - Config::inst()->unnest(); + Config::unnest(); } /** diff --git a/tests/php/SubsiteTest.php b/tests/php/SubsiteTest.php index 610adb13..d90e9163 100644 --- a/tests/php/SubsiteTest.php +++ b/tests/php/SubsiteTest.php @@ -2,6 +2,7 @@ namespace SilverStripe\Subsites\Tests; +use Page; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Director; use SilverStripe\Core\Config\Config; diff --git a/tests/php/SubsitesVirtualPageTest.php b/tests/php/SubsitesVirtualPageTest.php index d5a3c6d2..4fc0ef59 100644 --- a/tests/php/SubsitesVirtualPageTest.php +++ b/tests/php/SubsitesVirtualPageTest.php @@ -2,6 +2,7 @@ namespace SilverStripe\Subsites\Tests; +use Page; use SilverStripe\Assets\Filesystem; use SilverStripe\Assets\Tests\Storage\AssetStoreTest\TestAssetStore; use SilverStripe\Control\Director; @@ -17,7 +18,7 @@ class SubsitesVirtualPageTest extends BaseSubsiteTest { public static $fixture_file = array( 'subsites/tests/php/SubsiteTest.yml', - 'subsites/tests/SubsitesVirtualPageTest.yml', + 'subsites/tests/php/SubsitesVirtualPageTest.yml', ); protected $illegalExtensions = array( diff --git a/tests/testscript-test-file.pdf b/tests/php/testscript-test-file.pdf similarity index 100% rename from tests/testscript-test-file.pdf rename to tests/php/testscript-test-file.pdf