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

DEP Use PHPUnit 11 #146

Merged
merged 1 commit into from
Sep 18, 2024
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
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 @@ -13,6 +13,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 @@ -127,7 +128,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 @@ -136,9 +137,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
Loading