From cba68d0f3b6d417163e58720de2b37cc11c52054 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Sun, 24 Oct 2021 15:07:51 +1300 Subject: [PATCH] API phpunit 9 support --- .travis.yml | 6 +++--- composer.json | 4 ++-- phpunit.xml.dist | 8 +++++--- tests/ServerTest.php | 10 +++++----- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.travis.yml b/.travis.yml index ac4698c..e417e3a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,13 @@ 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 before_script: diff --git a/composer.json b/composer.json index 34d8c49..eb5c448 100644 --- a/composer.json +++ b/composer.json @@ -5,10 +5,10 @@ "require": { "php": "^5.6||^7.0", "symfony/process": "^3.0 || ^4.0", - "silverstripe/framework": "^4" + "silverstripe/framework": "^4.10" }, "require-dev": { - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^9" }, "autoload": { "psr-4": { 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(); }