Skip to content

Commit

Permalink
API phpunit 9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Nov 1, 2021
1 parent 23ba53f commit 9ad015f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
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:
- phpenv rehash
- 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:
Expand Down
11 changes: 3 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default">
<directory>tests</directory>
</testsuite>
<testsuites>
<testsuite name="Default">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
10 changes: 5 additions & 5 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand All @@ -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();
Expand All @@ -41,7 +41,7 @@ public function testStartTwiceFails()
]);

// Start fails because the server is already started
$this->setExpectedException('LogicException');
$this->expectException(\LogicException::class);
$server->start();
}

Expand All @@ -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();
}

Expand Down

0 comments on commit 9ad015f

Please sign in to comment.