From bd65d5e9a5939fbf79a80dc8bae02cc6638a2d78 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Fri, 6 Sep 2024 17:31:50 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- tests/php/Controllers/LinkFieldControllerTest.php | 14 +++++++------- tests/php/Form/MultiLinkFieldTest.php | 2 +- tests/php/Models/LinkTest.php | 12 ++++++------ tests/php/Services/LinkTypeServiceTest.php | 2 +- tests/php/Traits/AllowedLinkClassesTraitTest.php | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/php/Controllers/LinkFieldControllerTest.php b/tests/php/Controllers/LinkFieldControllerTest.php index 188b4746..65362c65 100644 --- a/tests/php/Controllers/LinkFieldControllerTest.php +++ b/tests/php/Controllers/LinkFieldControllerTest.php @@ -115,7 +115,7 @@ public function testLinkFormGetSchema( } } - public function provideLinkFormGetSchema(): array + public static function provideLinkFormGetSchema(): array { return [ 'Valid existing record' => [ @@ -202,7 +202,7 @@ public function testExcludeLinkTextField(bool $excludeLinkTextField): void } } - public function provideExcludeLinkTextField(): array + public static function provideExcludeLinkTextField(): array { return [ 'exclude field' => [ @@ -311,7 +311,7 @@ public function testLinkFormPost( } } - public function provideLinkFormPost(): array + public static function provideLinkFormPost(): array { // note: not duplicating code paths already tested with provideLinkFormGetSchema() // e.g. Reject Invalid ID @@ -444,7 +444,7 @@ public function testLinkFormReadonly(string $idType, string $fail, bool $expecte $this->assertSame($expected, $actual); } - public function provideLinkFormReadOnly(): array + public static function provideLinkFormReadOnly(): array { return [ [ @@ -495,7 +495,7 @@ public function testLinkData( } } - public function provideLinkData(): array + public static function provideLinkData(): array { return [ 'Valid' => [ @@ -567,7 +567,7 @@ public function testLinkArchive( } } - public function provideLinkArchive(): array + public static function provideLinkArchive(): array { return [ 'Valid' => [ @@ -669,7 +669,7 @@ public function testLinkSort( ); } - public function provideLinkSort(): array + public static function provideLinkSort(): array { return [ 'Success' => [ diff --git a/tests/php/Form/MultiLinkFieldTest.php b/tests/php/Form/MultiLinkFieldTest.php index 5865f3c8..5306df68 100644 --- a/tests/php/Form/MultiLinkFieldTest.php +++ b/tests/php/Form/MultiLinkFieldTest.php @@ -10,7 +10,7 @@ class MultiLinkFieldTest extends SapphireTest { - public function provideConvertValueToArray(): array + public static function provideConvertValueToArray(): array { return [ 'empty string' => [ diff --git a/tests/php/Models/LinkTest.php b/tests/php/Models/LinkTest.php index 2ba5a9f0..380e1b83 100644 --- a/tests/php/Models/LinkTest.php +++ b/tests/php/Models/LinkTest.php @@ -119,7 +119,7 @@ public function testLinkType(string $class, bool $expected): void : $this->assertNull($linkTypeField, 'We do not expect to a find link type field'); } - public function linkTypeProvider(): array + public static function linkTypeProvider(): array { return [ [EmailLink::class, false], @@ -152,7 +152,7 @@ public function testGetVersionedState(): void $this->assertEquals('unversioned', $link->getVersionedState()); } - public function provideGetUrl(): array + public static function provideGetUrl(): array { return [ 'internal link / page only' => [ @@ -242,7 +242,7 @@ public function testGetUrl(string $identifier, string $class, string $expected): $this->assertSame($expected, $link->getURL(), 'We expect specific URL value'); } - function provideDefaultLinkTitle(): array + static function provideDefaultLinkTitle(): array { return [ 'page link' => [ @@ -314,7 +314,7 @@ public function testDefaultLinkTitle(string $identifier, string $class, string $ $this->assertEquals($expected, $link->getTitle()); } - public function provideOwner() + public static function provideOwner() { return [ 'null because there is no owner' => [ @@ -421,7 +421,7 @@ public function testCanPermissions(string $linkPermission, string $ownerPermissi $this->assertFalse($link->can($permissionName)); } - public function provideCanPermissions() + public static function provideCanPermissions() { return [ 'canView' => [ @@ -447,7 +447,7 @@ public function testCanCreate() $this->assertTrue($link->can('Create')); } - public function provideLinkType(): array + public static function provideLinkType(): array { return [ 'email_link_type' => [ diff --git a/tests/php/Services/LinkTypeServiceTest.php b/tests/php/Services/LinkTypeServiceTest.php index c55b2d58..e9eeada4 100644 --- a/tests/php/Services/LinkTypeServiceTest.php +++ b/tests/php/Services/LinkTypeServiceTest.php @@ -49,7 +49,7 @@ public function testGenerateAllLinkTypes() $this->assertSame($expected, $types); } - public function keyClassDataProvider(): array + public static function keyClassDataProvider(): array { return [ 'sitetree_key' => [ diff --git a/tests/php/Traits/AllowedLinkClassesTraitTest.php b/tests/php/Traits/AllowedLinkClassesTraitTest.php index 056aa0b8..a7a08794 100644 --- a/tests/php/Traits/AllowedLinkClassesTraitTest.php +++ b/tests/php/Traits/AllowedLinkClassesTraitTest.php @@ -53,7 +53,7 @@ public function testSetAllowedTypes(array $enabled, array $expected) $this->assertEquals($expected, $result); } - public function allowedTypesDataProvider() : array + public static function allowedTypesDataProvider() : array { return [ 'allow all Link classes' => [ @@ -91,7 +91,7 @@ public function testSetAllowedTypesException(array $enabled) $trait->setAllowedTypes($enabled); } - public function provideTypesExceptionDataProvider() : array + public static function provideTypesExceptionDataProvider() : array { return [ 'allow all with empty array' => [ @@ -106,7 +106,7 @@ public function provideTypesExceptionDataProvider() : array ]; } - public function sortedTypesDataProvider() : array + public static function sortedTypesDataProvider() : array { return [ 'sort all allowed Link classes' => [ @@ -199,7 +199,7 @@ public function testGetTypesPropCanCreate(): void $this->assertFalse($json['testphone']['allowed']); } - public function provideGetTypesProp() : array + public static function provideGetTypesProp() : array { return [ 'SiteTreeLink props' => [