diff --git a/composer.json b/composer.json index 54407a7..a8182fa 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,14 @@ } ], "require": { - "silverstripe/framework": "^4.4", + "php": "^7.3 || ^8.0", + "silverstripe/framework": "^4.10", "silverstripe/reports": "^4.4", "symbiote/silverstripe-queuedjobs": "^4", "guzzlehttp/guzzle": "^6.3" }, "require-dev": { - "sminnee/phpunit": "^5.7", + "phpunit/phpunit": "^9.5", "squizlabs/php_codesniffer": "^3", "symfony/thanks": "^1.0" }, @@ -36,9 +37,6 @@ } }, "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - }, "expose": [ "client/dist" ] diff --git a/tests/Forms/GridFieldLinkButtonTest.php b/tests/Forms/GridFieldLinkButtonTest.php index cfbdadc..6dac37f 100644 --- a/tests/Forms/GridFieldLinkButtonTest.php +++ b/tests/Forms/GridFieldLinkButtonTest.php @@ -15,6 +15,6 @@ public function testCorrectLinkIsContained() $button = new GridFieldLinkButton('https://addons.silverstripe.org', 'Explore Addons', 'test'); $output = $button->getHTMLFragments(null); - $this->assertContains('https://addons.silverstripe.org', $output['test']); + $this->assertStringContainsString('https://addons.silverstripe.org', $output['test']); } } diff --git a/tests/Forms/GridFieldRefreshButtonTest.php b/tests/Forms/GridFieldRefreshButtonTest.php index caa75dd..34eb563 100644 --- a/tests/Forms/GridFieldRefreshButtonTest.php +++ b/tests/Forms/GridFieldRefreshButtonTest.php @@ -14,7 +14,7 @@ class GridFieldRefreshButtonTest extends SapphireTest { protected static $fixture_file = 'GridFieldRefreshButtonTest.yml'; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -68,7 +68,7 @@ public function testHandleRefreshCreatesJobWhenNoJobIsRunning() public function testHandleCheckReturnsValidJson() { $button = $this->getButton(); - $this->assertSame('true', $button->handleCheck()); + $this->assertStringContainsString('true', $button->handleCheck()); } public function testButtonIsDisabledWhenJobIsRunning() @@ -79,7 +79,7 @@ public function testButtonIsDisabledWhenJobIsRunning() $output = $button->getHTMLFragments($gridFieldMock); - $this->assertContains('disabled', $output['test']); + $this->assertStringContainsString('disabled', $output['test']); } public function testButtonIsEnabledWhenNoJobIsRunning() @@ -92,7 +92,7 @@ public function testButtonIsEnabledWhenNoJobIsRunning() $output = $button->getHTMLFragments($gridFieldMock); - $this->assertNotContains('disabled', $output['test']); + $this->assertStringNotContainsString('disabled', $output['test']); } /** diff --git a/tests/Reports/SiteSummaryTest.php b/tests/Reports/SiteSummaryTest.php index 0d2e3db..1b97306 100644 --- a/tests/Reports/SiteSummaryTest.php +++ b/tests/Reports/SiteSummaryTest.php @@ -20,7 +20,7 @@ class SiteSummaryTest extends SapphireTest ], ]; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -52,6 +52,6 @@ public function testAlertsRenderAtopTheReportField() $fields = $summaryReport->getCMSFields(); $alertSummary = $fields->fieldByName('AlertSummary'); $this->assertInstanceOf(LiteralField::class, $alertSummary); - $this->assertContains('Sound the alarm!', $alertSummary->getContent()); + $this->assertStringContainsString('Sound the alarm!', $alertSummary->getContent()); } } diff --git a/tests/Tasks/UpdatePackageInfoTest.php b/tests/Tasks/UpdatePackageInfoTest.php index e81e743..b2d4024 100644 --- a/tests/Tasks/UpdatePackageInfoTest.php +++ b/tests/Tasks/UpdatePackageInfoTest.php @@ -47,7 +47,7 @@ public function testGetPackageInfo() /** @var UpdatePackageInfoTask $processor */ $processor = UpdatePackageInfoTask::create(); $output = $processor->getPackageInfo($lockOutput); - $this->assertInternalType('array', $output); + $this->assertIsArray($output); $this->assertCount(1, $output); $this->assertContains([ "Name" => "fake/package", @@ -74,7 +74,7 @@ public function testGetSupportedPackagesEchosErrors() $task->getSupportedPackages(); $output = ob_get_clean(); - $this->assertContains('A test message', $output); + $this->assertStringContainsString('A test message', $output); } public function testPackagesAreAddedCorrectly() diff --git a/tests/Util/ApiLoaderTest.php b/tests/Util/ApiLoaderTest.php index 00e9e4f..023ff2d 100644 --- a/tests/Util/ApiLoaderTest.php +++ b/tests/Util/ApiLoaderTest.php @@ -2,6 +2,7 @@ namespace BringYourOwnIdeas\Maintenance\Tests\Util; +use RuntimeException; use BringYourOwnIdeas\Maintenance\Util\ApiLoader; use GuzzleHttp\Client; use GuzzleHttp\Handler\MockHandler; @@ -12,12 +13,10 @@ class ApiLoaderTest extends SapphireTest { - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Could not obtain information about module. Error code 404 - */ public function testNon200ErrorCodesAreHandled() { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Could not obtain information about module. Error code 404'); $loader = $this->getLoader(); $loader->setGuzzleClient($this->getMockClient(new Response(404))); @@ -26,12 +25,10 @@ public function testNon200ErrorCodesAreHandled() }); } - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Could not obtain information about module. Response is not JSON - */ public function testNonJsonResponsesAreHandled() { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Could not obtain information about module. Response is not JSON'); $loader = $this->getLoader(); $loader->setGuzzleClient($this->getMockClient(new Response( 200, @@ -43,12 +40,10 @@ public function testNonJsonResponsesAreHandled() }); } - /** - * @expectedException RuntimeException - * @expectedExceptionMessage Could not obtain information about module. Response returned unsuccessfully - */ public function testUnsuccessfulResponsesAreHandled() { + $this->expectException(RuntimeException::class); + $this->expectExceptionMessage('Could not obtain information about module. Response returned unsuccessfully'); $loader = $this->getLoader(); $loader->setGuzzleClient($this->getMockClient(new Response( 200, diff --git a/tests/Util/ModuleHealthLoaderTest.php b/tests/Util/ModuleHealthLoaderTest.php index 00634c4..c6ed3df 100644 --- a/tests/Util/ModuleHealthLoaderTest.php +++ b/tests/Util/ModuleHealthLoaderTest.php @@ -10,7 +10,7 @@ class ModuleHealthLoaderTest extends SapphireTest */ protected $loader; - protected function setUp() + protected function setUp(): void { parent::setUp(); diff --git a/tests/Util/SupportedAddonsLoaderTest.php b/tests/Util/SupportedAddonsLoaderTest.php index 4156996..51e5674 100644 --- a/tests/Util/SupportedAddonsLoaderTest.php +++ b/tests/Util/SupportedAddonsLoaderTest.php @@ -12,7 +12,7 @@ class SupportedAddonsLoaderTest extends SapphireTest */ protected $loader; - protected function setUp() + protected function setUp(): void { parent::setUp();