mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
FIX Use merge or set instead of update for config calls
This commit is contained in:
parent
732bdd2734
commit
c3cda42b92
@ -169,7 +169,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
*/
|
*/
|
||||||
public function testThatGetCMSFieldsWorksOnEveryPageType()
|
public function testThatGetCMSFieldsWorksOnEveryPageType()
|
||||||
{
|
{
|
||||||
$classes = ClassInfo::subclassesFor("SilverStripe\\CMS\\Model\\SiteTree");
|
$classes = ClassInfo::subclassesFor(SiteTree::class);
|
||||||
array_shift($classes);
|
array_shift($classes);
|
||||||
|
|
||||||
foreach ($classes as $class) {
|
foreach ($classes as $class) {
|
||||||
@ -184,7 +184,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
$page->Title = "Test $class page";
|
$page->Title = "Test $class page";
|
||||||
$page->write();
|
$page->write();
|
||||||
$page->flushCache();
|
$page->flushCache();
|
||||||
$page = DataObject::get_by_id("SilverStripe\\CMS\\Model\\SiteTree", $page->ID);
|
$page = DataObject::get_by_id(SiteTree::class, $page->ID);
|
||||||
|
|
||||||
$this->assertTrue($page->getCMSFields() instanceof FieldList);
|
$this->assertTrue($page->getCMSFields() instanceof FieldList);
|
||||||
}
|
}
|
||||||
@ -194,7 +194,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'enforce_strict_hierarchy', true);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', true);
|
||||||
$parentPage = $this->objFromFixture(Page::class, 'page3');
|
$parentPage = $this->objFromFixture(Page::class, 'page3');
|
||||||
$childPage = $this->objFromFixture(Page::class, 'page1');
|
$childPage = $this->objFromFixture(Page::class, 'page1');
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
$actions,
|
$actions,
|
||||||
'Can publish a page with an unpublished parent with strict hierarchy off'
|
'Can publish a page with an unpublished parent with strict hierarchy off'
|
||||||
);
|
);
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'enforce_strict_hierarchy', false);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -228,7 +228,7 @@ class CMSMainTest extends FunctionalTest
|
|||||||
$livePage = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, array(
|
$livePage = Versioned::get_one_by_stage(SiteTree::class, Versioned::LIVE, array(
|
||||||
'"SiteTree"."ID"' => $pageID
|
'"SiteTree"."ID"' => $pageID
|
||||||
));
|
));
|
||||||
$this->assertInstanceOf('SilverStripe\\CMS\\Model\\SiteTree', $livePage);
|
$this->assertInstanceOf(SiteTree::class, $livePage);
|
||||||
$this->assertTrue($livePage->canDelete());
|
$this->assertTrue($livePage->canDelete());
|
||||||
|
|
||||||
// Check that the 'restore' button exists as a simple way of checking that the correct page is returned.
|
// Check that the 'restore' button exists as a simple way of checking that the correct page is returned.
|
||||||
|
@ -35,7 +35,7 @@ class ContentControllerTest extends FunctionalTest
|
|||||||
public function testNestedPages()
|
public function testNestedPages()
|
||||||
{
|
{
|
||||||
RootURLController::reset();
|
RootURLController::reset();
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$this->assertEquals('Home Page', $this->get('/')->getBody());
|
$this->assertEquals('Home Page', $this->get('/')->getBody());
|
||||||
$this->assertEquals('Home Page', $this->get('/home/index/')->getBody());
|
$this->assertEquals('Home Page', $this->get('/home/index/')->getBody());
|
||||||
@ -50,7 +50,7 @@ class ContentControllerTest extends FunctionalTest
|
|||||||
$this->assertEquals('Third Level Page', $this->get('/home/second-level/third-level/second-index/')->getBody());
|
$this->assertEquals('Third Level Page', $this->get('/home/second-level/third-level/second-index/')->getBody());
|
||||||
|
|
||||||
RootURLController::reset();
|
RootURLController::reset();
|
||||||
SiteTree::config()->nested_urls = false;
|
Config::modify()->set(SiteTree::class, 'nested_urls', false);
|
||||||
|
|
||||||
$this->assertEquals('Home Page', $this->get('/')->getBody());
|
$this->assertEquals('Home Page', $this->get('/')->getBody());
|
||||||
$this->assertEquals('Home Page', $this->get('/home/')->getBody());
|
$this->assertEquals('Home Page', $this->get('/home/')->getBody());
|
||||||
@ -72,7 +72,7 @@ class ContentControllerTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
$controller = new ContentController();
|
$controller = new ContentController();
|
||||||
|
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$this->assertEquals(1, $controller->ChildrenOf('/')->Count());
|
$this->assertEquals(1, $controller->ChildrenOf('/')->Count());
|
||||||
$this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
|
$this->assertEquals(1, $controller->ChildrenOf('/home/')->Count());
|
||||||
@ -89,7 +89,7 @@ class ContentControllerTest extends FunctionalTest
|
|||||||
|
|
||||||
public function testDeepNestedURLs()
|
public function testDeepNestedURLs()
|
||||||
{
|
{
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
$page->URLSegment = 'base-page';
|
$page->URLSegment = 'base-page';
|
||||||
|
@ -29,7 +29,7 @@ class ModelAsControllerTest extends FunctionalTest
|
|||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ class ModelAsControllerTest extends FunctionalTest
|
|||||||
public function testChildOfDraft()
|
public function testChildOfDraft()
|
||||||
{
|
{
|
||||||
RootURLController::reset();
|
RootURLController::reset();
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$draft = new Page();
|
$draft = new Page();
|
||||||
$draft->Title = 'Root Leve Draft Page';
|
$draft->Title = 'Root Leve Draft Page';
|
||||||
|
@ -17,9 +17,9 @@ class RootURLControllerTest extends SapphireTest
|
|||||||
{
|
{
|
||||||
$default = $this->objFromFixture('Page', 'home');
|
$default = $this->objFromFixture('Page', 'home');
|
||||||
|
|
||||||
SiteTree::config()->nested_urls = false;
|
Config::modify()->set(SiteTree::class, 'nested_urls', false);
|
||||||
$this->assertEquals('home', RootURLController::get_homepage_link());
|
$this->assertEquals('home', RootURLController::get_homepage_link());
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\SiteTree', 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
$this->assertEquals('home', RootURLController::get_homepage_link());
|
$this->assertEquals('home', RootURLController::get_homepage_link());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$this->assertEquals($staff->ID, SiteTree::get_by_link($staff->Link(), false)->ID);
|
$this->assertEquals($staff->ID, SiteTree::get_by_link($staff->Link(), false)->ID);
|
||||||
$this->assertEquals($product->ID, SiteTree::get_by_link($product->Link(), false)->ID);
|
$this->assertEquals($product->ID, SiteTree::get_by_link($product->Link(), false)->ID);
|
||||||
|
|
||||||
Config::inst()->update(SiteTree::class, 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$this->assertEquals($home->ID, SiteTree::get_by_link('/', false)->ID);
|
$this->assertEquals($home->ID, SiteTree::get_by_link('/', false)->ID);
|
||||||
$this->assertEquals($home->ID, SiteTree::get_by_link('/home/', false)->ID);
|
$this->assertEquals($home->ID, SiteTree::get_by_link('/home/', false)->ID);
|
||||||
@ -373,7 +373,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$about = $this->objFromFixture('Page', 'about');
|
$about = $this->objFromFixture('Page', 'about');
|
||||||
$staff = $this->objFromFixture('Page', 'staff');
|
$staff = $this->objFromFixture('Page', 'staff');
|
||||||
|
|
||||||
Config::inst()->update(SiteTree::class, 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$this->assertEquals('about-us/', $about->RelativeLink(), 'Matches URLSegment on top level without parameters');
|
$this->assertEquals('about-us/', $about->RelativeLink(), 'Matches URLSegment on top level without parameters');
|
||||||
$this->assertEquals('about-us/my-staff/', $staff->RelativeLink(), 'Matches URLSegment plus parent on second level without parameters');
|
$this->assertEquals('about-us/my-staff/', $staff->RelativeLink(), 'Matches URLSegment plus parent on second level without parameters');
|
||||||
@ -394,7 +394,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$parent = $this->objFromFixture('Page', 'about');
|
$parent = $this->objFromFixture('Page', 'about');
|
||||||
$child = $this->objFromFixture('Page', 'staff');
|
$child = $this->objFromFixture('Page', 'staff');
|
||||||
|
|
||||||
Config::inst()->update(SiteTree::class, 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$child->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$child->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$parent->URLSegment = 'changed-on-live';
|
$parent->URLSegment = 'changed-on-live';
|
||||||
@ -442,7 +442,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
|
|
||||||
public function testDeleteFromStageOperatesRecursively()
|
public function testDeleteFromStageOperatesRecursively()
|
||||||
{
|
{
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', false);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', false);
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
$pageStaff = $this->objFromFixture('Page', 'staff');
|
$pageStaff = $this->objFromFixture('Page', 'staff');
|
||||||
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
|
$pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate');
|
||||||
@ -452,7 +452,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$this->assertNull(DataObject::get_by_id('Page', $pageAbout->ID));
|
$this->assertNull(DataObject::get_by_id('Page', $pageAbout->ID));
|
||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', true);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteFromStageOperatesRecursivelyStrict()
|
public function testDeleteFromStageOperatesRecursivelyStrict()
|
||||||
@ -479,7 +479,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
|
|
||||||
public function testDeleteFromLiveOperatesRecursively()
|
public function testDeleteFromLiveOperatesRecursively()
|
||||||
{
|
{
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', false);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', false);
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
@ -499,12 +499,12 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', true);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn()
|
public function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn()
|
||||||
{
|
{
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', false);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', false);
|
||||||
$this->logInWithPermission('ADMIN');
|
$this->logInWithPermission('ADMIN');
|
||||||
|
|
||||||
$pageAbout = $this->objFromFixture('Page', 'about');
|
$pageAbout = $this->objFromFixture('Page', 'about');
|
||||||
@ -522,7 +522,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaff->ID) instanceof Page);
|
||||||
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
$this->assertTrue(DataObject::get_by_id('Page', $pageStaffDuplicate->ID) instanceof Page);
|
||||||
Versioned::set_stage(Versioned::DRAFT);
|
Versioned::set_stage(Versioned::DRAFT);
|
||||||
Config::inst()->update(SiteTree::class, 'enforce_strict_hierarchy', true);
|
Config::modify()->set(SiteTree::class, 'enforce_strict_hierarchy', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeleteFromLiveOperatesRecursivelyStrict()
|
public function testDeleteFromLiveOperatesRecursivelyStrict()
|
||||||
@ -909,7 +909,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$sitetree->URLSegment = 'home';
|
$sitetree->URLSegment = 'home';
|
||||||
$this->assertFalse($sitetree->validURLSegment(), 'Conflicts are still recognised with a ParentID value');
|
$this->assertFalse($sitetree->validURLSegment(), 'Conflicts are still recognised with a ParentID value');
|
||||||
|
|
||||||
Config::inst()->update(SiteTree::class, 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$sitetree->ParentID = 0;
|
$sitetree->ParentID = 0;
|
||||||
$sitetree->URLSegment = 'home';
|
$sitetree->URLSegment = 'home';
|
||||||
@ -940,7 +940,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
*/
|
*/
|
||||||
public function testValidURLSegmentControllerConflicts()
|
public function testValidURLSegmentControllerConflicts()
|
||||||
{
|
{
|
||||||
Config::inst()->update(SiteTree::class, 'nested_urls', true);
|
Config::modify()->set(SiteTree::class, 'nested_urls', true);
|
||||||
|
|
||||||
$sitetree = new SiteTree();
|
$sitetree = new SiteTree();
|
||||||
$sitetree->ParentID = $this->idFromFixture('SiteTreeTest_Conflicted', 'parent');
|
$sitetree->ParentID = $this->idFromFixture('SiteTreeTest_Conflicted', 'parent');
|
||||||
@ -1023,7 +1023,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
|
$this->assertContains('Page', $classes, 'Page types do contain subclasses');
|
||||||
|
|
||||||
// Testing what happens in an incorrect config value is set - hide_ancestor should be a string
|
// Testing what happens in an incorrect config value is set - hide_ancestor should be a string
|
||||||
Config::inst()->update(SiteTreeTest_ClassA::class, 'hide_ancestor', true);
|
Config::modify()->set(SiteTreeTest_ClassA::class, 'hide_ancestor', true);
|
||||||
$newClasses = SiteTree::page_type_classes();
|
$newClasses = SiteTree::page_type_classes();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
$classes,
|
$classes,
|
||||||
@ -1220,7 +1220,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// test proper escaping of quotes in attribute value
|
// test proper escaping of quotes in attribute value
|
||||||
Config::inst()->update(SiteTree::class, 'meta_generator', 'Generator with "quotes" in it');
|
Config::modify()->set(SiteTree::class, 'meta_generator', 'Generator with "quotes" in it');
|
||||||
$meta = $page->MetaTags();
|
$meta = $page->MetaTags();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
1,
|
1,
|
||||||
@ -1229,7 +1229,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// test empty generator - no tag should appear at all
|
// test empty generator - no tag should appear at all
|
||||||
Config::inst()->update(SiteTree::class, 'meta_generator', '');
|
Config::modify()->set(SiteTree::class, 'meta_generator', '');
|
||||||
$meta = $page->MetaTags();
|
$meta = $page->MetaTags();
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
0,
|
0,
|
||||||
@ -1238,7 +1238,7 @@ class SiteTreeTest extends SapphireTest
|
|||||||
);
|
);
|
||||||
|
|
||||||
// reset original value
|
// reset original value
|
||||||
Config::inst()->update(SiteTree::class, 'meta_generator', $generator);
|
Config::modify()->set(SiteTree::class, 'meta_generator', $generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$this->logInWithPermission("ADMIN");
|
$this->logInWithPermission("ADMIN");
|
||||||
|
|
||||||
// Add extra fields
|
// Add extra fields
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\VirtualPage', 'initially_copied_fields', array('MyInitiallyCopiedField'));
|
Config::modify()->merge(VirtualPage::class, 'initially_copied_fields', array('MyInitiallyCopiedField'));
|
||||||
Config::inst()->update('SilverStripe\\CMS\\Model\\VirtualPage', 'non_virtual_fields', array('MyNonVirtualField', 'MySharedNonVirtualField'));
|
Config::modify()->merge(VirtualPage::class, 'non_virtual_fields', array('MyNonVirtualField', 'MySharedNonVirtualField'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,8 +63,8 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$master->Content = "<p>New content</p>";
|
$master->Content = "<p>New content</p>";
|
||||||
$master->write();
|
$master->write();
|
||||||
|
|
||||||
$vp1 = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1');
|
$vp1 = $this->objFromFixture(VirtualPage::class, 'vp1');
|
||||||
$vp2 = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2');
|
$vp2 = $this->objFromFixture(VirtualPage::class, 'vp2');
|
||||||
|
|
||||||
$this->assertEquals("New title", $vp1->Title);
|
$this->assertEquals("New title", $vp1->Title);
|
||||||
$this->assertEquals("New title", $vp2->Title);
|
$this->assertEquals("New title", $vp2->Title);
|
||||||
@ -90,16 +90,16 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$master->Content = "<p>New content</p>";
|
$master->Content = "<p>New content</p>";
|
||||||
$master->write();
|
$master->write();
|
||||||
|
|
||||||
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp1'));
|
||||||
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp2'));
|
||||||
$this->assertTrue($vp1->publishRecursive());
|
$this->assertTrue($vp1->publishRecursive());
|
||||||
$this->assertTrue($vp2->publishRecursive());
|
$this->assertTrue($vp2->publishRecursive());
|
||||||
|
|
||||||
$master->publishRecursive();
|
$master->publishRecursive();
|
||||||
|
|
||||||
Versioned::set_stage(Versioned::LIVE);
|
Versioned::set_stage(Versioned::LIVE);
|
||||||
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp1'));
|
$vp1 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp1'));
|
||||||
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp2'));
|
$vp2 = DataObject::get_by_id(VirtualPage::class, $this->idFromFixture(VirtualPage::class, 'vp2'));
|
||||||
|
|
||||||
$this->assertNotNull($vp1);
|
$this->assertNotNull($vp1);
|
||||||
$this->assertNotNull($vp2);
|
$this->assertNotNull($vp2);
|
||||||
@ -242,7 +242,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
public function testCanEdit()
|
public function testCanEdit()
|
||||||
{
|
{
|
||||||
$parentPage = $this->objFromFixture('Page', 'master3');
|
$parentPage = $this->objFromFixture('Page', 'master3');
|
||||||
$virtualPage = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp3');
|
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp3');
|
||||||
$bob = $this->objFromFixture('SilverStripe\\Security\\Member', 'bob');
|
$bob = $this->objFromFixture('SilverStripe\\Security\\Member', 'bob');
|
||||||
$andrew = $this->objFromFixture('SilverStripe\\Security\\Member', 'andrew');
|
$andrew = $this->objFromFixture('SilverStripe\\Security\\Member', 'andrew');
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
{
|
{
|
||||||
$parentPage = $this->objFromFixture('Page', 'master3');
|
$parentPage = $this->objFromFixture('Page', 'master3');
|
||||||
$parentPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$parentPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$virtualPage = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp3');
|
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp3');
|
||||||
$virtualPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
$virtualPage->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
$cindy = $this->objFromFixture('SilverStripe\\Security\\Member', 'cindy');
|
$cindy = $this->objFromFixture('SilverStripe\\Security\\Member', 'cindy');
|
||||||
$alice = $this->objFromFixture('SilverStripe\\Security\\Member', 'alice');
|
$alice = $this->objFromFixture('SilverStripe\\Security\\Member', 'alice');
|
||||||
@ -487,7 +487,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
$virtual->CopyContentFromID = $page->ID;
|
$virtual->CopyContentFromID = $page->ID;
|
||||||
$virtual->write();
|
$virtual->write();
|
||||||
|
|
||||||
$virtual = DataObject::get_by_id('SilverStripe\\CMS\\Model\\VirtualPage', $virtual->ID, false);
|
$virtual = DataObject::get_by_id(VirtualPage::class, $virtual->ID, false);
|
||||||
$virtual->CopyContentFromID = $notRootPage->ID;
|
$virtual->CopyContentFromID = $notRootPage->ID;
|
||||||
$virtual->flushCache();
|
$virtual->flushCache();
|
||||||
|
|
||||||
@ -632,7 +632,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
|
|
||||||
public function testMethod()
|
public function testMethod()
|
||||||
{
|
{
|
||||||
$virtualPage = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp4');
|
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
||||||
$controller = ModelAsController::controller_for($virtualPage);
|
$controller = ModelAsController::controller_for($virtualPage);
|
||||||
|
|
||||||
$this->assertInstanceOf('VirtualPageTest_ClassAController', $controller);
|
$this->assertInstanceOf('VirtualPageTest_ClassAController', $controller);
|
||||||
@ -644,7 +644,7 @@ class VirtualPageTest extends FunctionalTest
|
|||||||
|
|
||||||
public function testAllowedActions()
|
public function testAllowedActions()
|
||||||
{
|
{
|
||||||
$virtualPage = $this->objFromFixture('SilverStripe\\CMS\\Model\\VirtualPage', 'vp4');
|
$virtualPage = $this->objFromFixture(VirtualPage::class, 'vp4');
|
||||||
$controller = ModelAsController::controller_for($virtualPage);
|
$controller = ModelAsController::controller_for($virtualPage);
|
||||||
$this->assertContains('testaction', $controller->allowedActions());
|
$this->assertContains('testaction', $controller->allowedActions());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user