From 47a70e1179b478cc8cc4eeeb390814e3c8d4021c Mon Sep 17 00:00:00 2001 From: Chris Penny Date: Mon, 2 May 2022 10:10:18 +1200 Subject: [PATCH] Update PHP dependency, dev dependencies, and workflow --- .github/workflows/main.yml | 12 +------ composer.json | 6 ++-- .../Extension/EmbargoExpiryExtensionTest.php | 34 +++++++++---------- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 197da01..3fc1da0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,14 +6,4 @@ on: jobs: ci: - uses: silverstripe/github-actions-ci-cd/.github/workflows/ci.yml@0.1.14 - with: - default_jobs: | - - php: 7.4 - phpcoverage: true - - php: 7.4 - phplinting: true - - php: 7.4 - phpunit: true - - php: 8.0 - phpunit: true + uses: silverstripe/github-actions-ci-cd/.github/workflows/ci.yml@v0.1 diff --git a/composer.json b/composer.json index bcfd655..79cebee 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "issues": "https://github.com/silverstripe-terraformers/embargo-expiry/issues" }, "require": { - "php": "^7.1 || ^8.0", + "php": "^7.4 || ^8.0", "silverstripe/vendor-plugin": "^1.0", "silverstripe/framework": "^4@dev", "silverstripe/cms": "^4@dev", @@ -27,8 +27,8 @@ "opis/closure": "^3.6" }, "require-dev": { - "phpunit/phpunit": "^5.7", - "tractorcow/silverstripe-fluent": "^4.2.0" + "phpunit/phpunit": "^9.5", + "tractorcow/silverstripe-fluent": "^6.0" }, "extra": { "expose": [ diff --git a/tests/php/Extension/EmbargoExpiryExtensionTest.php b/tests/php/Extension/EmbargoExpiryExtensionTest.php index a4b49a7..cf8e100 100644 --- a/tests/php/Extension/EmbargoExpiryExtensionTest.php +++ b/tests/php/Extension/EmbargoExpiryExtensionTest.php @@ -2,12 +2,13 @@ namespace Terraformers\EmbargoExpiry\Tests\Extension; +use DateTimeImmutable; use Exception; +use Page; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Core\Config\Config; use SilverStripe\Dev\SapphireTest; use SilverStripe\Forms\FieldList; -use SilverStripe\Forms\FormAction; use SilverStripe\Forms\LiteralField; use SilverStripe\Forms\TabSet; use SilverStripe\ORM\FieldType\DBDatetime; @@ -16,7 +17,6 @@ use Symbiote\QueuedJobs\Services\QueuedJobService; use Terraformers\EmbargoExpiry\Extension\EmbargoExpiryExtension; use Terraformers\EmbargoExpiry\Tests\Fake\TestQueuedJobService; -use DateTimeImmutable; /** * Class EmbargoExpiryExtensionTest @@ -239,9 +239,9 @@ public function testMessageConditionsCanEdit(): void $expectedEmbargoMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $time->getTimezone()->getName()); $expectedExpiryMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $time->getTimezone()->getName()); - $this->assertNotContains('cannot currently be edited', $content); - $this->assertContains($expectedEmbargoMessage, $content); - $this->assertContains($expectedExpiryMessage, $content); + $this->assertStringNotContainsString('cannot currently be edited', $content); + $this->assertStringContainsString($expectedEmbargoMessage, $content); + $this->assertStringContainsString($expectedExpiryMessage, $content); } public function testMessageConditionsCannotEditGuest(): void @@ -269,10 +269,10 @@ public function testMessageConditionsCannotEditGuest(): void $expectedEmbargoMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $time->getTimezone()->getName()); $expectedExpiryMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $time->getTimezone()->getName()); - $this->assertContains('cannot currently be edited', $content); - $this->assertContains('An administrator will need', $content); - $this->assertContains($expectedEmbargoMessage, $content); - $this->assertContains($expectedExpiryMessage, $content); + $this->assertStringContainsString('cannot currently be edited', $content); + $this->assertStringContainsString('An administrator will need', $content); + $this->assertStringContainsString($expectedEmbargoMessage, $content); + $this->assertStringContainsString($expectedExpiryMessage, $content); } public function testMessageConditionsCannotEditAdmin(): void @@ -300,10 +300,10 @@ public function testMessageConditionsCannotEditAdmin(): void $expectedEmbargoMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $now->getTimezone()->getName()); $expectedExpiryMessage = sprintf('Embargo: 2014-01-07 12:00 %s', $now->getTimezone()->getName()); - $this->assertContains('cannot currently be edited', $content); - $this->assertContains('You will need to remove', $content); - $this->assertContains($expectedEmbargoMessage, $content); - $this->assertContains($expectedExpiryMessage, $content); + $this->assertStringContainsString('cannot currently be edited', $content); + $this->assertStringContainsString('You will need to remove', $content); + $this->assertStringContainsString($expectedEmbargoMessage, $content); + $this->assertStringContainsString($expectedExpiryMessage, $content); } public function testMessageConditionsWarning(): void @@ -338,8 +338,8 @@ public function testMessageConditionsWarning(): void ); // Test that the two warning messages were added. - $this->assertContains($expectedEmbargoMessage, $content); - $this->assertContains($expectedExpiryMessage, $content); + $this->assertStringContainsString($expectedEmbargoMessage, $content); + $this->assertStringContainsString($expectedExpiryMessage, $content); } public function testEmbargoExpiryFieldNoticeMessageNotEditable(): void @@ -364,7 +364,7 @@ public function testEmbargoExpiryFieldNoticeMessageWithPermission(): void $message = $page->getEmbargoExpiryFieldNoticeMessage(); $this->assertNotNull($message); - $this->assertContains('Enter a date and/or time', $message); + $this->assertStringContainsString('Enter a date and/or time', $message); } public function testEmbargoExpiryFieldNoticeMessageWithoutPermission(): void @@ -379,7 +379,7 @@ public function testEmbargoExpiryFieldNoticeMessageWithoutPermission(): void $message = $page->getEmbargoExpiryFieldNoticeMessage(); $this->assertNotNull($message); - $this->assertContains('Please contact an administrator', $message); + $this->assertStringContainsString('Please contact an administrator', $message); } public function testAddDesiredDateFieldsWithoutPermission(): void