From abe1ac9fe6c9f8e852ed815d89c7dacbe61b3873 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Werner=20M=2E=20Krau=C3=9F?= Date: Thu, 1 Jun 2017 14:57:28 +0200 Subject: [PATCH] fixing code analysis: replacing deprecated methods --- code/extensions/ControllerSubsites.php | 2 +- code/model/Subsite.php | 2 +- code/tasks/SubsiteCopyPagesTask.php | 2 +- tests/behat/features/bootstrap/Context/FeatureContext.php | 2 +- tests/php/SiteTreeSubsitesTest.php | 6 +++--- tests/php/SubsiteTest.php | 2 +- tests/php/SubsitesVirtualPageTest.php | 6 +++--- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/code/extensions/ControllerSubsites.php b/code/extensions/ControllerSubsites.php index 4e6d9c57..779a2dc7 100644 --- a/code/extensions/ControllerSubsites.php +++ b/code/extensions/ControllerSubsites.php @@ -15,7 +15,7 @@ public function controllerAugmentInit() { if ($subsite = Subsite::currentSubsite()) { if ($theme = $subsite->Theme) { - SSViewer::set_theme($theme); + SSViewer::set_themes([$theme, SSViewer::DEFAULT_THEME]); } } } diff --git a/code/model/Subsite.php b/code/model/Subsite.php index 3cbccc6a..bba27e69 100644 --- a/code/model/Subsite.php +++ b/code/model/Subsite.php @@ -936,7 +936,7 @@ public function duplicate($doWrite = true) $childClone = $child->duplicateToSubsite($duplicate, false); $childClone->ParentID = $destParentID; $childClone->writeToStage('Stage'); - $childClone->publish('Stage', 'Live'); + $childClone->copyVersionToStage('Stage', 'Live'); self::changeSubsite($this->ID); //Change Back to this subsite diff --git a/code/tasks/SubsiteCopyPagesTask.php b/code/tasks/SubsiteCopyPagesTask.php index 0815466d..957fa265 100644 --- a/code/tasks/SubsiteCopyPagesTask.php +++ b/code/tasks/SubsiteCopyPagesTask.php @@ -74,7 +74,7 @@ public function run($request) $childClone->ParentID = $destParentID; $childClone->writeToStage('Stage'); - $childClone->publish('Stage', 'Live'); + $childClone->copyVersionToStage('Stage', 'Live'); array_push($stack, array($child->ID, $childClone->ID)); $this->log(sprintf('Copied "%s" (#%d, %s)', $child->Title, $child->ID, $child->Link())); diff --git a/tests/behat/features/bootstrap/Context/FeatureContext.php b/tests/behat/features/bootstrap/Context/FeatureContext.php index 1cd4c395..198e16dc 100644 --- a/tests/behat/features/bootstrap/Context/FeatureContext.php +++ b/tests/behat/features/bootstrap/Context/FeatureContext.php @@ -71,7 +71,7 @@ public function __construct(array $parameters) foreach (ClassInfo::subclassesFor(SiteTree::class) as $id => $class) { $blueprint = Injector::inst()->create(FixtureBlueprint::class, $class); $blueprint->addCallback('afterCreate', function ($obj, $identifier, &$data, &$fixtures) { - $obj->publish('Stage', 'Live'); + $obj->copyVersionToStage('Stage', 'Live'); }); $factory->define($class, $blueprint); } diff --git a/tests/php/SiteTreeSubsitesTest.php b/tests/php/SiteTreeSubsitesTest.php index 9782f614..9348f5c5 100644 --- a/tests/php/SiteTreeSubsitesTest.php +++ b/tests/php/SiteTreeSubsitesTest.php @@ -42,12 +42,12 @@ public function testPagesInDifferentSubsitesCanShareURLSegment() $pageMain = new SiteTree(); $pageMain->URLSegment = 'testpage'; $pageMain->write(); - $pageMain->publish('Stage', 'Live'); + $pageMain->copyVersionToStage('Stage', 'Live'); $pageMainOther = new SiteTree(); $pageMainOther->URLSegment = 'testpage'; $pageMainOther->write(); - $pageMainOther->publish('Stage', 'Live'); + $pageMainOther->copyVersionToStage('Stage', 'Live'); $this->assertNotEquals($pageMain->URLSegment, $pageMainOther->URLSegment, 'Pages in same subsite cant share the same URL' @@ -58,7 +58,7 @@ public function testPagesInDifferentSubsitesCanShareURLSegment() $pageSubsite1 = new SiteTree(); $pageSubsite1->URLSegment = 'testpage'; $pageSubsite1->write(); - $pageSubsite1->publish('Stage', 'Live'); + $pageSubsite1->copyVersionToStage('Stage', 'Live'); $this->assertEquals($pageMain->URLSegment, $pageSubsite1->URLSegment, 'Pages in different subsites can share the same URL' diff --git a/tests/php/SubsiteTest.php b/tests/php/SubsiteTest.php index 7e1fbada..8602ce3f 100644 --- a/tests/php/SubsiteTest.php +++ b/tests/php/SubsiteTest.php @@ -68,7 +68,7 @@ public function testSubsiteCreation() $totalPages = $pages->count(); foreach ($pages as $page) { $this->assertEquals($template->ID, $page->SubsiteID); - $page->publish('Stage', 'Live'); + $page->copyVersionToStage('Stage', 'Live'); } // Create a new site diff --git a/tests/php/SubsitesVirtualPageTest.php b/tests/php/SubsitesVirtualPageTest.php index dead1aa9..34e39216 100644 --- a/tests/php/SubsitesVirtualPageTest.php +++ b/tests/php/SubsitesVirtualPageTest.php @@ -172,7 +172,7 @@ public function testPublishedSubsiteVirtualPagesUpdateIfTargetPageUpdates() $p->Content = 'Content'; $p->Title = 'Title'; $p->writeToStage('Stage'); - $p->publish('Stage', 'Live'); + $p->copyVersionToStage('Stage', 'Live'); $this->assertTrue($p->ExistsOnLive); // change to subsite @@ -185,7 +185,7 @@ public function testPublishedSubsiteVirtualPagesUpdateIfTargetPageUpdates() $svp->CopyContentFromID = $p->ID; $svp->write(); $svp->writeToStage('Stage'); - $svp->publish('Stage', 'Live'); + $svp->copyVersionToStage('Stage', 'Live'); $this->assertEquals($svp->SubsiteID, $subsite->ID); $this->assertTrue($svp->ExistsOnLive); @@ -196,7 +196,7 @@ public function testPublishedSubsiteVirtualPagesUpdateIfTargetPageUpdates() $p->Title = 'New Title'; // "save & publish" $p->writeToStage('Stage'); - $p->publish('Stage', 'Live'); + $p->copyVersionToStage('Stage', 'Live'); $this->assertNotEquals($p->SubsiteID, $subsite->ID); // reload SVP from database