From 99dc351ca95d08aa316799c5640861a7040a823b Mon Sep 17 00:00:00 2001 From: Sabina Talipova Date: Fri, 9 Dec 2022 13:10:50 +1300 Subject: [PATCH] DEP PHP Support in CMS5 --- composer.json | 14 +++++++------- .../PageTypes/DatedUpdateHolderControllerTest.php | 10 +++++++--- tests/PageTypes/SitemapPageTest.php | 3 ++- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index b347403..6de5743 100644 --- a/composer.json +++ b/composer.json @@ -8,17 +8,17 @@ ], "license": "BSD-3-Clause", "require": { - "php": "^7.3 || ^8.0", - "silverstripe/framework": "^4.10", - "cwp/cwp-core": "^2", - "silverstripe/cms": "^4", - "silverstripe/taxonomy": "^2", - "symbiote/silverstripe-gridfieldextensions": "^3.2" + "php": "^8.1", + "silverstripe/framework": "^5", + "cwp/cwp-core": "^3", + "silverstripe/cms": "^5", + "silverstripe/taxonomy": "^3", + "symbiote/silverstripe-gridfieldextensions": "^4" }, "require-dev": { "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3", - "cwp/starter-theme": "^2" + "cwp/starter-theme": "^4" }, "conflict": { "silverstripe/auditor": "<2.2.1" diff --git a/tests/PageTypes/DatedUpdateHolderControllerTest.php b/tests/PageTypes/DatedUpdateHolderControllerTest.php index 5da6618..8a68d04 100644 --- a/tests/PageTypes/DatedUpdateHolderControllerTest.php +++ b/tests/PageTypes/DatedUpdateHolderControllerTest.php @@ -30,7 +30,8 @@ public function testSettingDateFiltersInReverseOrderShowsMessage() /** @var EventHolder $holder */ $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1'); - $result = $this->get($holder->Link() . '?from=2018-01-10&to=2018-01-01'); + $this->logInWithPermission('VIEW_DRAFT_CONTENT'); + $result = $this->get($holder->Link() . '?stage=Stage' . '&from=2018-01-10&to=2018-01-01'); $this->assertStringContainsString('Filter has been applied with the dates reversed', $result->getBody()); } @@ -43,7 +44,8 @@ public function testSettingFromButNotToDateShowsMessage() /** @var EventHolder $holder */ $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1'); - $result = $this->get($holder->Link() . '?from=2018-01-10'); + $this->logInWithPermission('VIEW_DRAFT_CONTENT'); + $result = $this->get($holder->Link() . '?stage=Stage' . '&from=2018-01-10'); $this->assertStringContainsString('Filtered by a single date', $result->getBody()); } @@ -55,7 +57,9 @@ public function testInvalidDateFormat() } /** @var EventHolder $holder */ $holder = $this->objFromFixture(EventHolder::class, 'EventHolder1'); - $result = $this->get($holder->Link() . '?from=christmas&to=2018-01-10'); + + $this->logInWithPermission('VIEW_DRAFT_CONTENT'); + $result = $this->get($holder->Link() . '?stage=Stage' . '&from=christmas&to=2018-01-10'); $this->assertStringContainsString(htmlentities('Dates must be in "y-MM-dd" format.'), $result->getBody()); } diff --git a/tests/PageTypes/SitemapPageTest.php b/tests/PageTypes/SitemapPageTest.php index b2607ba..55d5071 100644 --- a/tests/PageTypes/SitemapPageTest.php +++ b/tests/PageTypes/SitemapPageTest.php @@ -25,7 +25,8 @@ protected function setUp(): void */ public function testSitemapShowsNavigationTitleNotNormalTitle() { - $response = $this->get('sitemap'); + $this->logInWithPermission('VIEW_DRAFT_CONTENT'); + $response = $this->get('sitemap?stage=Stage'); $parser = new CSSContentParser($response->getBody()); $elements = $parser->getBySelector('.sitemap li.first .sitemap-link'); $this->assertNotEmpty($elements);