mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
DEP Use PHPUnit 11
This commit is contained in:
parent
fee08b13c0
commit
a3b96bab57
@ -20,7 +20,7 @@
|
|||||||
"silverstripe/cms": "^6"
|
"silverstripe/cms": "^6"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^9.6",
|
"phpunit/phpunit": "^11.3",
|
||||||
"squizlabs/php_codesniffer": "^3",
|
"squizlabs/php_codesniffer": "^3",
|
||||||
"symbiote/silverstripe-queuedjobs": "^6",
|
"symbiote/silverstripe-queuedjobs": "^6",
|
||||||
"silverstripe/standards": "^1",
|
"silverstripe/standards": "^1",
|
||||||
|
@ -13,6 +13,7 @@ use SilverStripe\ExternalLinks\Tests\Stubs\ExternalLinksTestPage;
|
|||||||
use SilverStripe\ExternalLinks\Tests\Stubs\PretendLinkChecker;
|
use SilverStripe\ExternalLinks\Tests\Stubs\PretendLinkChecker;
|
||||||
use SilverStripe\i18n\i18n;
|
use SilverStripe\i18n\i18n;
|
||||||
use SilverStripe\Reports\Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
|
|
||||||
class ExternalLinksTest extends FunctionalTest
|
class ExternalLinksTest extends FunctionalTest
|
||||||
{
|
{
|
||||||
@ -127,7 +128,7 @@ class ExternalLinksTest extends FunctionalTest
|
|||||||
$this->assertEquals(3, BrokenExternalLinksReport::create()->sourceRecords()->count());
|
$this->assertEquals(3, BrokenExternalLinksReport::create()->sourceRecords()->count());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function provideGetJobStatus(): array
|
public static function provideGetJobStatus(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'ADMIN - valid permission' => ['ADMIN', 200],
|
'ADMIN - valid permission' => ['ADMIN', 200],
|
||||||
@ -136,9 +137,7 @@ class ExternalLinksTest extends FunctionalTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[DataProvider('provideGetJobStatus')]
|
||||||
* @dataProvider provideGetJobStatus
|
|
||||||
*/
|
|
||||||
public function testGetJobStatus(
|
public function testGetJobStatus(
|
||||||
string $permission,
|
string $permission,
|
||||||
int $expectedResponseCode
|
int $expectedResponseCode
|
||||||
|
@ -4,12 +4,11 @@ namespace SilverStripe\ExternalLinks\Tests\Model;
|
|||||||
|
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\ExternalLinks\Model\BrokenExternalLink;
|
use SilverStripe\ExternalLinks\Model\BrokenExternalLink;
|
||||||
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
|
|
||||||
class BrokenExternalLinkTest extends SapphireTest
|
class BrokenExternalLinkTest extends SapphireTest
|
||||||
{
|
{
|
||||||
/**
|
#[DataProvider('httpCodeProvider')]
|
||||||
* @dataProvider httpCodeProvider
|
|
||||||
*/
|
|
||||||
public function testGetHTTPCodeDescription(int $httpCode, string $expected)
|
public function testGetHTTPCodeDescription(int $httpCode, string $expected)
|
||||||
{
|
{
|
||||||
$link = new BrokenExternalLink();
|
$link = new BrokenExternalLink();
|
||||||
@ -17,7 +16,7 @@ class BrokenExternalLinkTest extends SapphireTest
|
|||||||
$this->assertSame($expected, $link->getHTTPCodeDescription());
|
$this->assertSame($expected, $link->getHTTPCodeDescription());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function httpCodeProvider(): array
|
public static function httpCodeProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
[200, '200 (OK)'],
|
[200, '200 (OK)'],
|
||||||
@ -28,7 +27,7 @@ class BrokenExternalLinkTest extends SapphireTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function permissionProvider(): array
|
public static function permissionProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
['admin', 'ADMIN'],
|
['admin', 'ADMIN'],
|
||||||
@ -37,9 +36,7 @@ class BrokenExternalLinkTest extends SapphireTest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[DataProvider('permissionProvider')]
|
||||||
* @dataProvider permissionProvider
|
|
||||||
*/
|
|
||||||
public function testCanViewReport(string $user, string $permission)
|
public function testCanViewReport(string $user, string $permission)
|
||||||
{
|
{
|
||||||
$this->logOut();
|
$this->logOut();
|
||||||
|
Loading…
Reference in New Issue
Block a user