Skip to content

Commit

Permalink
API phpunit9 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 27, 2021
1 parent d78c3e7 commit cccd1a8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
4 changes: 0 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,3 @@ version: ~> 1.0

import:
- silverstripe/silverstripe-travis-shared:config/provision/standard-jobs-range-behat-npm.yml

env:
global:
- REQUIRE_RECIPE="4.8.x-dev || "
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"silverstripe/admin": "^1.7",
"silverstripe/framework": "^4.8",
"silverstripe/framework": "^4.10",
"ua-parser/uap-php": "^3.5"
},
"require-dev": {
"sminnee/phpunit": "^5.7",
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.0",
"symbiote/silverstripe-queuedjobs": "^4"
},
Expand Down
8 changes: 5 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<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
7 changes: 4 additions & 3 deletions tests/behat/src/FixtureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SilverStripe\SessionManager\Tests\Behat\Context;

use Behat\Mink\Element\NodeElement;
use PHPUnit\Framework\Assert;
use SilverStripe\BehatExtension\Context\FixtureContext as BaseFixtureContext;
use SilverStripe\Control\Controller;
use SilverStripe\Security\Member;
Expand All @@ -21,7 +22,7 @@ public function iSeeTheElement($selector): void
{
$page = $this->getMainContext()->getSession()->getPage();
$element = $page->find('css', $selector);
assertNotNull($element, sprintf('Element %s not found', $selector));
Assert::assertNotNull($element, sprintf('Element %s not found', $selector));
}

/**
Expand All @@ -33,8 +34,8 @@ public function iShouldSeeTheTextInTheElement(string $text, string $selector): v
$page = $this->getMainContext()->getSession()->getPage();
/** @var NodeElement $element */
$element = $page->find('css', $selector);
assertNotNull($element, sprintf('Element %s not found', $selector));
assertSame($text, $element->getText());
Assert::assertNotNull($element, sprintf('Element %s not found', $selector));
Assert::assertSame($text, $element->getText());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/php/Control/LoginSessionControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class LoginSessionControllerTest extends FunctionalTest
/** @var HttpRequest */
private $request;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down Expand Up @@ -195,7 +195,7 @@ private function assertResponse(HTTPResponse $response, $code, $toast, $message)
['message' => $toast],
$body
);
$this->assertContains(
$this->assertStringContainsString(
'no-store',
$response->getHeader('Cache-Control'),
'Login Session Controller response is never cached',
Expand Down
2 changes: 1 addition & 1 deletion tests/php/Extensions/MemberExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MemberExtensionTest extends SapphireTest
]
];

public function setUp()
protected function setUp(): void
{
parent::setUp();
ForcePermission::reset();
Expand Down

0 comments on commit cccd1a8

Please sign in to comment.