Skip to content

Commit

Permalink
DEP Use PHPUnit 11
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 9, 2024
1 parent 815b758 commit 6d20398
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"silverstripe/cms": "^6"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
"phpunit/phpunit": "^11.3",
"squizlabs/php_codesniffer": "^3",
"symbiote/silverstripe-queuedjobs": "^6",
"silverstripe/standards": "^1",
Expand Down
7 changes: 3 additions & 4 deletions tests/php/ExternalLinksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use SilverStripe\ExternalLinks\Tests\Stubs\PretendLinkChecker;
use SilverStripe\i18n\i18n;
use SilverStripe\Reports\Report;
use PHPUnit\Framework\Attributes\DataProvider;

class ExternalLinksTest extends FunctionalTest
{
Expand Down Expand Up @@ -126,7 +127,7 @@ public function testArchivedPagesAreHiddenFromReport()
$this->assertEquals(3, BrokenExternalLinksReport::create()->sourceRecords()->count());
}

public function provideGetJobStatus(): array
public static function provideGetJobStatus(): array
{
return [
'ADMIN - valid permission' => ['ADMIN', 200],
Expand All @@ -135,9 +136,7 @@ public function provideGetJobStatus(): array
];
}

/**
* @dataProvider provideGetJobStatus
*/
#[DataProvider('provideGetJobStatus')]
public function testGetJobStatus(
string $permission,
int $expectedResponseCode
Expand Down
13 changes: 5 additions & 8 deletions tests/php/Model/BrokenExternalLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@

use SilverStripe\Dev\SapphireTest;
use SilverStripe\ExternalLinks\Model\BrokenExternalLink;
use PHPUnit\Framework\Attributes\DataProvider;

class BrokenExternalLinkTest extends SapphireTest
{
/**
* @dataProvider httpCodeProvider
*/
#[DataProvider('httpCodeProvider')]
public function testGetHTTPCodeDescription(int $httpCode, string $expected)
{
$link = new BrokenExternalLink();
$link->HTTPCode = $httpCode;
$this->assertSame($expected, $link->getHTTPCodeDescription());
}

public function httpCodeProvider(): array
public static function httpCodeProvider(): array
{
return [
[200, '200 (OK)'],
Expand All @@ -28,7 +27,7 @@ public function httpCodeProvider(): array
];
}

public function permissionProvider(): array
public static function permissionProvider(): array
{
return [
['admin', 'ADMIN'],
Expand All @@ -37,9 +36,7 @@ public function permissionProvider(): array
];
}

/**
* @dataProvider permissionProvider
*/
#[DataProvider('permissionProvider')]
public function testCanViewReport(string $user, string $permission)
{
$this->logOut();
Expand Down

0 comments on commit 6d20398

Please sign in to comment.