From 9ad015f3499bf617569e1060041d7d09dff3e555 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 2 Nov 2021 09:52:06 +1300 Subject: [PATCH] API phpunit 9 support --- .travis.yml | 10 ++++++---- composer.json | 11 +++-------- phpunit.xml.dist | 8 +++++--- tests/ServerTest.php | 10 +++++----- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac4698c..3ab7625 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,15 @@ language: php -dist: trusty +dist: xenial matrix: fast_finish: true include: - - php: 5.6 + - php: 7.3 env: PHPUNIT_TEST=1 PHPCS_TEST=1 - - php: 7.0 + - php: 7.4 + env: PHPUNIT_TEST=1 + - php: 8.0 env: PHPUNIT_TEST=1 before_script: @@ -15,7 +17,7 @@ before_script: - export PATH=~/.composer/vendor/bin:$PATH - composer validate - if [[ $PHPCS_TEST ]]; then composer require squizlabs/php_codesniffer:^3 --no-update --prefer-dist --dev; fi - - composer require --prefer-dist --no-update silverstripe/recipe-core:1.x-dev + - composer require --prefer-dist --no-update silverstripe/recipe-core:4.x-dev - composer install --prefer-dist script: diff --git a/composer.json b/composer.json index 34d8c49..95f8dfa 100644 --- a/composer.json +++ b/composer.json @@ -3,23 +3,18 @@ "description": "Connects the PHP development server to SilverStripe", "license": "MIT", "require": { - "php": "^5.6||^7.0", + "php": "^7.3 || ^8.0", "symfony/process": "^3.0 || ^4.0", - "silverstripe/framework": "^4" + "silverstripe/framework": "^4.10" }, "require-dev": { - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { "SilverStripe\\Serve\\": "code/" } }, - "extra": { - "branch-alias": { - "2.x-dev": "2.1.x-dev" - } - }, "bin": [ "bin/serve" ], diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 0af0562..faddb61 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,5 +1,7 @@ - - tests - + + + tests + + diff --git a/tests/ServerTest.php b/tests/ServerTest.php index 6d3f149..41a35b2 100644 --- a/tests/ServerTest.php +++ b/tests/ServerTest.php @@ -3,11 +3,11 @@ namespace SilverStripe\Serve\Tests; use BadMethodCallException; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use SilverStripe\Serve\ServerFactory; use SilverStripe\Serve\PortChecker; -class ServerTest extends PHPUnit_Framework_TestCase +class ServerTest extends TestCase { public function testStartStop() { @@ -25,7 +25,7 @@ public function testStartStop() $content = file_get_contents($server->getURL() . 'Security/login'); // Check that the login form exists on the displayed page - $this->assertContains('MemberLoginForm_LoginForm', $content); + $this->assertStringContainsString('MemberLoginForm_LoginForm', $content); // When it stops, it stops listening $server->stop(); @@ -41,7 +41,7 @@ public function testStartTwiceFails() ]); // Start fails because the server is already started - $this->setExpectedException('LogicException'); + $this->expectException(\LogicException::class); $server->start(); } @@ -56,7 +56,7 @@ public function testStopTwiceFails() $server->stop(); // Stop a 2nd fails because the server is already stopped - $this->setExpectedException('LogicException'); + $this->expectException(\LogicException::class); $server->stop(); }