Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API phpunit 9 support #410

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,16 @@ env:
matrix:
fast_finish: true
include:
- php: 7.2
env: DB=PGSQL PHPUNIT_TEST=1 PHPCS_TEST=1
- php: 7.3
maxime-rainville marked this conversation as resolved.
Show resolved Hide resolved
env: DB=MYSQL PHPUNIT_TEST=1
- php: 7.3
env: DB=MYSQL PDO=1 PHPUNIT_COVERAGE_TEST=1
env: DB=MYSQL PDO=1 PHPUNIT_TEST=1 PHPCS_TEST=1
- php: 7.4
env: DB=MYSQL PHPUNIT_TEST=1
env: DB=PGSQL PHPUNIT_TEST=1 PHPUNIT_COVERAGE_TEST=1
- php: 7.3
env: DB=MYSQL BEHAT_TEST=1
- php: 7.3
- php: 7.4
env: DB=MYSQL ASSETADMIN_TEST=1
# TODO https://github.com/silverstripe/silverstripe-asset-admin/issues/1163
allow_failures:
- php: 7.3
env: DB=MYSQL BEHAT_TEST=1
- php: 8.0
env: DB=MYSQL PHPUNIT_TEST=1

before_script:
# separately create artifacts directory for asset-admin behat test
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"type": "silverstripe-vendormodule",
"license": "BSD-3-Clause",
"require": {
"silverstripe/framework": "^4",
"php": "^7.3 || ^8.0",
"silverstripe/framework": "^4.10",
"silverstripe/vendor-plugin": "^1.0",
"webonyx/graphql-php": "^14.0",
"silverstripe/event-dispatcher": "^0.1.2"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"sminnee/phpunit-mock-objects": "^3.4.5",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0",
"silverstripe/versioned": "^1.0@dev"
},
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<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>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
Expand Down
2 changes: 1 addition & 1 deletion tests/Auth/HandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class HandlerTest extends SapphireTest
/**
* {@inheritDoc}
*/
protected function setUp() : void
protected function setUp(): void
{
parent::setUp();
Handler::config()->remove('authenticators');
Expand Down
4 changes: 2 additions & 2 deletions tests/Middleware/CSRFMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function testItDoesntDoAnythingIfNotAMutation()
public function testItThrowsIfNoTokenIsProvided()
{
$this->expectException(Exception::class);
$this->expectExceptionMessageRegExp('/must provide a CSRF token/');
$this->expectExceptionMessageMatches('/must provide a CSRF token/');
$result = $this->simulateMiddlewareProcess(
new CSRFMiddleware(),
' mutation someMutation { tester }'
Expand Down Expand Up @@ -69,7 +69,7 @@ public function testItThrowsIfNoTokenIsProvided()
public function testItThrowsIfTokenIsInvalid()
{
$this->expectException(Exception::class);
$this->expectExceptionMessageRegExp('/Invalid CSRF token/');
$this->expectExceptionMessageMatches('/Invalid CSRF token/');
$result = $this->simulateMiddlewareProcess(
new CSRFMiddleware(),
' mutation someMutation { tester }',
Expand Down
2 changes: 1 addition & 1 deletion tests/Middleware/MiddlewareProcessTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class MiddlewareProcessTestBase extends SapphireTest
*/
protected $defaultCallback;

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->defaultCallback = function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/Schema/DataObject/FieldAccessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FieldAccessorTest extends SapphireTest
Member::class,
];

protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->obj = new FakeProduct();
Expand Down
4 changes: 2 additions & 2 deletions tests/Schema/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class IntegrationTest extends SapphireTest
Member::class,
];

protected function setUp()
protected function setUp(): void
{
parent::setUp();
TestStoreCreator::$dir = __DIR__;
}

protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();
$this->clean();
Expand Down
2 changes: 1 addition & 1 deletion tests/Schema/SchemaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class SchemaTest extends SapphireTest
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
// Kill the global schema
Expand Down