From 7593464358fb428c65cfefa084a8b0bea67c68e4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Wed, 11 Sep 2024 19:17:37 +1200 Subject: [PATCH] DEP Use PHPUnit 11 --- .../Controllers/LinkFieldControllerTest.php | 43 ++++++---------- tests/php/Form/MultiLinkFieldTest.php | 7 ++- tests/php/Models/LinkTest.php | 32 +++++------- tests/php/Services/LinkTypeServiceTest.php | 12 ++--- .../php/Tasks/GorriecoeMigrationTaskTest.php | 31 +++++------ .../php/Tasks/LinkFieldMigrationTaskTest.php | 51 ++++++++----------- .../Traits/AllowedLinkClassesTraitTest.php | 25 ++++----- 7 files changed, 77 insertions(+), 124 deletions(-) diff --git a/tests/php/Controllers/LinkFieldControllerTest.php b/tests/php/Controllers/LinkFieldControllerTest.php index 188b4746..63cdf66d 100644 --- a/tests/php/Controllers/LinkFieldControllerTest.php +++ b/tests/php/Controllers/LinkFieldControllerTest.php @@ -12,6 +12,7 @@ use SilverStripe\LinkField\Tests\Models\LinkTest\LinkOwner; use SilverStripe\Versioned\Versioned; use SilverStripe\LinkField\Models\Link; +use PHPUnit\Framework\Attributes\DataProvider; class LinkFieldControllerTest extends FunctionalTest { @@ -61,9 +62,7 @@ protected function tearDown(): void LinkOwner::add_extension(Versioned::class); } - /** - * @dataProvider provideLinkFormGetSchema - */ + #[DataProvider('provideLinkFormGetSchema')] public function testLinkFormGetSchema( string $idType, string $typeKey, @@ -115,7 +114,7 @@ public function testLinkFormGetSchema( } } - public function provideLinkFormGetSchema(): array + public static function provideLinkFormGetSchema(): array { return [ 'Valid existing record' => [ @@ -170,9 +169,7 @@ public function provideLinkFormGetSchema(): array ]; } - /** - * @dataProvider provideExcludeLinkTextField - */ + #[DataProvider('provideExcludeLinkTextField')] public function testExcludeLinkTextField(bool $excludeLinkTextField): void { $owner = $this->getFixtureLinkOwner(); @@ -202,7 +199,7 @@ public function testExcludeLinkTextField(bool $excludeLinkTextField): void } } - public function provideExcludeLinkTextField(): array + public static function provideExcludeLinkTextField(): array { return [ 'exclude field' => [ @@ -214,9 +211,7 @@ public function provideExcludeLinkTextField(): array ]; } - /** - * @dataProvider provideLinkFormPost - */ + #[DataProvider('provideLinkFormPost')] public function testLinkFormPost( string $idType, string $typeKey, @@ -311,7 +306,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 @@ -423,9 +418,7 @@ public function provideLinkFormPost(): array ]; } - /** - * @dataProvider provideLinkFormReadOnly - */ + #[DataProvider('provideLinkFormReadOnly')] public function testLinkFormReadonly(string $idType, string $fail, bool $expected): void { TestPhoneLink::$fail = $fail; @@ -444,7 +437,7 @@ public function testLinkFormReadonly(string $idType, string $fail, bool $expecte $this->assertSame($expected, $actual); } - public function provideLinkFormReadOnly(): array + public static function provideLinkFormReadOnly(): array { return [ [ @@ -470,9 +463,7 @@ public function provideLinkFormReadOnly(): array ]; } - /** - * @dataProvider provideLinkData - */ + #[DataProvider('provideLinkData')] public function testLinkData( string $idType, int $expectedCode, @@ -495,7 +486,7 @@ public function testLinkData( } } - public function provideLinkData(): array + public static function provideLinkData(): array { return [ 'Valid' => [ @@ -529,9 +520,7 @@ public function provideLinkData(): array ]; } - /** - * @dataProvider provideLinkArchive - */ + #[DataProvider('provideLinkArchive')] public function testLinkArchive( string $idType, string $fail, @@ -567,7 +556,7 @@ public function testLinkArchive( } } - public function provideLinkArchive(): array + public static function provideLinkArchive(): array { return [ 'Valid' => [ @@ -633,9 +622,7 @@ public function testLinkDeleteVersions(): void $this->assertNull($liveLink); } - /** - * @dataProvider provideLinkSort - */ + #[DataProvider('provideLinkSort')] public function testLinkSort( array $newLinkTextOrder, string $fail, @@ -669,7 +656,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..95aa7b68 100644 --- a/tests/php/Form/MultiLinkFieldTest.php +++ b/tests/php/Form/MultiLinkFieldTest.php @@ -7,10 +7,11 @@ use SilverStripe\Dev\SapphireTest; use SilverStripe\LinkField\Form\MultiLinkField; use SilverStripe\ORM\ArrayList; +use PHPUnit\Framework\Attributes\DataProvider; class MultiLinkFieldTest extends SapphireTest { - public function provideConvertValueToArray(): array + public static function provideConvertValueToArray(): array { return [ 'empty string' => [ @@ -56,9 +57,7 @@ public function provideConvertValueToArray(): array ]; } - /** - * @dataProvider provideConvertValueToArray - */ + #[DataProvider('provideConvertValueToArray')] public function testConvertValueToArray(mixed $value, array $expected): void { $field = new MultiLinkField(''); diff --git a/tests/php/Models/LinkTest.php b/tests/php/Models/LinkTest.php index 2ba5a9f0..345977d5 100644 --- a/tests/php/Models/LinkTest.php +++ b/tests/php/Models/LinkTest.php @@ -25,6 +25,7 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\LinkField\Tests\Controllers\LinkFieldControllerTest\TestPhoneLink; use SilverStripe\LinkField\Tests\Models\SiteTreeLinkTest\TestSiteTreeCanView; +use PHPUnit\Framework\Attributes\DataProvider; class LinkTest extends SapphireTest { @@ -106,8 +107,8 @@ public function testSiteTreeLinkTitleFallback(): void * @param string $class * @param bool $expected * @throws ReflectionException - * @dataProvider linkTypeProvider */ + #[DataProvider('linkTypeProvider')] public function testLinkType(string $class, bool $expected): void { /** @var Link $model */ @@ -119,7 +120,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 +153,7 @@ public function testGetVersionedState(): void $this->assertEquals('unversioned', $link->getVersionedState()); } - public function provideGetUrl(): array + public static function provideGetUrl(): array { return [ 'internal link / page only' => [ @@ -233,8 +234,8 @@ public function provideGetUrl(): array * @param string $class * @param string $expected * @return void - * @dataProvider provideGetUrl */ + #[DataProvider('provideGetUrl')] public function testGetUrl(string $identifier, string $class, string $expected): void { /** @var Link $link */ @@ -242,7 +243,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' => [ @@ -303,9 +304,7 @@ function provideDefaultLinkTitle(): array ]; } - /** - * @dataProvider provideDefaultLinkTitle - */ + #[DataProvider('provideDefaultLinkTitle')] public function testDefaultLinkTitle(string $identifier, string $class, string $expected): void { /** @var Link $link */ @@ -314,7 +313,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' => [ @@ -344,9 +343,8 @@ public function provideOwner() * Test the functionality of the overridden Owner method. * Note this is NOT explicitly testing multi-relational has_many relations pointing at the has_one since that's * a framework functionality, not a linkfield one. - * - * @dataProvider provideOwner */ + #[DataProvider('provideOwner')] public function testOwner(string $class, string $fixture, ?array $expected) { $link = $this->objFromFixture($class, $fixture); @@ -401,9 +399,7 @@ public function testOwnerHasOne() $this->assertSame($owner->ID, $link->Owner()?->ID); } - /** - * @dataProvider provideCanPermissions - */ + #[DataProvider('provideCanPermissions')] public function testCanPermissions(string $linkPermission, string $ownerPermission) { $link = $this->objFromFixture(SiteTreeLink::class, 'page-link-page-only'); @@ -421,7 +417,7 @@ public function testCanPermissions(string $linkPermission, string $ownerPermissi $this->assertFalse($link->can($permissionName)); } - public function provideCanPermissions() + public static function provideCanPermissions() { return [ 'canView' => [ @@ -447,7 +443,7 @@ public function testCanCreate() $this->assertTrue($link->can('Create')); } - public function provideLinkType(): array + public static function provideLinkType(): array { return [ 'email_link_type' => [ @@ -477,9 +473,7 @@ public function provideLinkType(): array ]; } - /** - * @dataProvider provideLinkType - */ + #[DataProvider('provideLinkType')] public function testGetShortCode(string $class, string $expected): void { $linkClass = Injector::inst()->get($class); diff --git a/tests/php/Services/LinkTypeServiceTest.php b/tests/php/Services/LinkTypeServiceTest.php index c55b2d58..fe9ab8bd 100644 --- a/tests/php/Services/LinkTypeServiceTest.php +++ b/tests/php/Services/LinkTypeServiceTest.php @@ -12,6 +12,7 @@ use SilverStripe\LinkField\Models\PhoneLink; use SilverStripe\LinkField\Models\SiteTreeLink; use SilverStripe\LinkField\Tests\Controllers\LinkFieldControllerTest\TestPhoneLink; +use PHPUnit\Framework\Attributes\DataProvider; class LinkTypeServiceTest extends SapphireTest { @@ -49,7 +50,7 @@ public function testGenerateAllLinkTypes() $this->assertSame($expected, $types); } - public function keyClassDataProvider(): array + public static function keyClassDataProvider(): array { return [ 'sitetree_key' => [ @@ -72,7 +73,6 @@ public function keyClassDataProvider(): array 'phone_key' => [ 'phone', PhoneLink::class, - 'testphone' => TestPhoneLink::class, ], 'testphone_key' => [ 'testphone', @@ -81,9 +81,7 @@ public function keyClassDataProvider(): array ]; } - /** - * @dataProvider keyClassDataProvider - */ + #[DataProvider('keyClassDataProvider')] public function testByKey($key, $class) { $service = new LinkTypeService(); @@ -93,9 +91,7 @@ public function testByKey($key, $class) $this->assertEquals($linkClass, $keyType); } - /** - * @dataProvider keyClassDataProvider - */ + #[DataProvider('keyClassDataProvider')] public function testKeyByClassName($key, $class) { $service = new LinkTypeService(); diff --git a/tests/php/Tasks/GorriecoeMigrationTaskTest.php b/tests/php/Tasks/GorriecoeMigrationTaskTest.php index 7c5abf5a..001daab6 100644 --- a/tests/php/Tasks/GorriecoeMigrationTaskTest.php +++ b/tests/php/Tasks/GorriecoeMigrationTaskTest.php @@ -27,6 +27,7 @@ use SilverStripe\ORM\FieldType\DBVarchar; use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLUpdate; +use PHPUnit\Framework\Attributes\DataProvider; class GorriecoeMigrationTaskTest extends SapphireTest { @@ -127,7 +128,7 @@ public function onBeforeLoadFixtures(): void parent::onBeforeLoadFixtures(); } - public function provideGetNeedsMigration(): array + public static function provideGetNeedsMigration(): array { return [ 'no old table' => [ @@ -145,9 +146,7 @@ public function provideGetNeedsMigration(): array ]; } - /** - * @dataProvider provideGetNeedsMigration - */ + #[DataProvider('provideGetNeedsMigration')] public function testGetNeedsMigration(string|bool $hasTable, bool $expected): void { if ($hasTable === false) { @@ -288,7 +287,7 @@ public function testUpdateSiteTreeRows(): void $this->assertEmpty($output); } - public function provideMigrateHasManyRelations(): array + public static function provideMigrateHasManyRelations(): array { return [ 'no has_many' => [ @@ -318,9 +317,7 @@ public function provideMigrateHasManyRelations(): array ]; } - /** - * @dataProvider provideMigrateHasManyRelations - */ + #[DataProvider('provideMigrateHasManyRelations')] public function testMigrateHasManyRelations( array $hasManyConfig, string $ownerFixture = null, @@ -381,7 +378,7 @@ public function testMigrateHasManyRelations( $this->assertSame($expectedOutput, $output); } - public function provideMigrateManyManyRelations(): array + public static function provideMigrateManyManyRelations(): array { return [ 'no relations' => [ @@ -441,9 +438,7 @@ public function provideMigrateManyManyRelations(): array ]; } - /** - * @dataProvider provideMigrateManyManyRelations - */ + #[DataProvider('provideMigrateManyManyRelations')] public function testMigrateManyManyRelations(array $manymanyConfig): void { GorriecoeMigrationTask::config()->set('many_many_links_data', $manymanyConfig); @@ -513,7 +508,7 @@ public function testMigrateManyManyRelations(array $manymanyConfig): void $this->assertSame($expectedOutput, $output); } - public function provideMigrateManyManyRelationsExceptions(): array + public static function provideMigrateManyManyRelationsExceptions(): array { $ownerClass = WasManyManyOwner::class; return [ @@ -557,9 +552,7 @@ public function provideMigrateManyManyRelationsExceptions(): array ]; } - /** - * @dataProvider provideMigrateManyManyRelationsExceptions - */ + #[DataProvider('provideMigrateManyManyRelationsExceptions')] public function testMigrateManyManyRelationsExceptions(array $config, string $expectedMessage): void { GorriecoeMigrationTask::config()->set('many_many_links_data', $config); @@ -678,7 +671,9 @@ private function startCapturingOutput(): void private function stopCapturingOutput(): string { - return ob_get_clean(); + $ret = ob_get_clean(); + flush(); + return $ret; } private function callPrivateMethod(string $methodName, array $args = []): mixed @@ -686,7 +681,7 @@ private function callPrivateMethod(string $methodName, array $args = []): mixed $task = new GorriecoeMigrationTask(); // getNeedsMigration() sets the table to pull from. // If we're not testing that method, we need to set the table ourselves. - if ($this->getName() !== 'testGetNeedsMigration') { + if ($this->name() !== 'testGetNeedsMigration') { $reflectionProperty = new ReflectionProperty($task, 'oldTableName'); $reflectionProperty->setAccessible(true); $reflectionProperty->setValue($task, self::OLD_LINK_TABLE); diff --git a/tests/php/Tasks/LinkFieldMigrationTaskTest.php b/tests/php/Tasks/LinkFieldMigrationTaskTest.php index 6fdda841..a104284d 100644 --- a/tests/php/Tasks/LinkFieldMigrationTaskTest.php +++ b/tests/php/Tasks/LinkFieldMigrationTaskTest.php @@ -36,6 +36,7 @@ use SilverStripe\ORM\Queries\SQLUpdate; use SilverStripe\Versioned\Versioned; use Symfony\Component\DomCrawler\Crawler; +use PHPUnit\Framework\Attributes\DataProvider; class LinkFieldMigrationTaskTest extends SapphireTest { @@ -71,7 +72,7 @@ protected function setUp(): void parent::setUp(); // Remove AmbiguousLinkOwner class from class manifest for all tests that it interferes with. - $name = $this->getName(false); + $name = $this->name(); if (str_starts_with($name, 'testSetOwnerForHasOneLinks') && $name !== 'testSetOwnerForHasOneLinksAmbiguous') { $this->needsResetSchema = true; $classManifest = ClassLoader::inst()->getManifest(); @@ -117,7 +118,7 @@ protected function tearDown(): void parent::tearDown(); } - public function provideGetNeedsMigration(): array + public static function provideGetNeedsMigration(): array { $scenarios = [ 'has both columns' => [ @@ -156,9 +157,7 @@ public function provideGetNeedsMigration(): array return $scenarios; } - /** - * @dataProvider provideGetNeedsMigration - */ + #[DataProvider('provideGetNeedsMigration')] public function testGetNeedsMigration(bool $hasTitleColumn, bool $hasLinkTextColumn, ?bool $extensionOverride, bool $expected): void { // Add/remove columns as necessary to replicate migration scenario @@ -198,7 +197,7 @@ public function testGetNeedsMigration(bool $hasTitleColumn, bool $hasLinkTextCol $this->assertSame($expectedOutput, $output); } - public function provideMigrateTitleColumnUnversioned(): array + public static function provideMigrateTitleColumnUnversioned(): array { return [ 'full migration' => [ @@ -226,8 +225,8 @@ public function provideMigrateTitleColumnUnversioned(): array /** * Tests migrating data when v2 and v3 were NOT versioned - * @dataProvider provideMigrateTitleColumnUnversioned */ + #[DataProvider('provideMigrateTitleColumnUnversioned')] public function testMigrateTitleColumnUnversioned(bool $skipMigration, bool $skipDropColumn, bool $v3IsVersioned): void { // Make sure the Title column exists before we start @@ -329,7 +328,7 @@ public function testMigrateTitleColumnUnversioned(bool $skipMigration, bool $ski } } - public function provideMigrateTitleColumnVersioned(): array + public static function provideMigrateTitleColumnVersioned(): array { return [ 'full migration' => [ @@ -349,8 +348,8 @@ public function provideMigrateTitleColumnVersioned(): array /** * Tests migrating data when v2 and v3 WERE versioned - * @dataProvider provideMigrateTitleColumnVersioned */ + #[DataProvider('provideMigrateTitleColumnVersioned')] public function testMigrateTitleColumnVersioned(?string $skipMigration, ?string $skipDropColumn): void { // Publish all links before we start so there's data in the _Versions and _Live columns @@ -463,7 +462,7 @@ public function testMigrateTitleColumnVersioned(?string $skipMigration, ?string } } - public function provideSetOwnerForHasOneLinks(): array + public static function provideSetOwnerForHasOneLinks(): array { return [ [ @@ -528,9 +527,7 @@ public function provideSetOwnerForHasOneLinks(): array ]; } - /** - * @dataProvider provideSetOwnerForHasOneLinks - */ + #[DataProvider('provideSetOwnerForHasOneLinks')] public function testSetOwnerForHasOneLinks(string $ownerClass, array $fixtureRelationsHaveLink): void { $this->startCapturingOutput(); @@ -600,7 +597,7 @@ public function testSetOwnerForHasOneLinks(string $ownerClass, array $fixtureRel $this->assertSame("Setting owners for has_one relations.\n", $output); } - public function provideSetOwnerForHasOneLinksSkipClass(): array + public static function provideSetOwnerForHasOneLinksSkipClass(): array { return [ 'skip all DataObjects' => [ @@ -613,9 +610,9 @@ public function provideSetOwnerForHasOneLinksSkipClass(): array } /** - * Tests that classes_that_are_not_link_owners skips both the class itself and all its subclasses. - * @dataProvider provideSetOwnerForHasOneLinksSkipClass + * Tests that classes_that_are_not_link_owners skips both the class itself and all its subclasses */ + #[DataProvider('provideSetOwnerForHasOneLinksSkipClass')] public function testSetOwnerForHasOneLinksSkipClass(string $skipHierarchy): void { LinkFieldMigrationTask::config()->merge('classes_that_are_not_link_owners', [$skipHierarchy]); @@ -685,7 +682,7 @@ public function testSetOwnerForHasOneLinksAmbiguous(): void $this->assertSame("Setting owners for has_one relations.\nAmbiguous relation '{$linkClass}.AmbiguousOwner' found - assuming it points at '{$foreignClass}.Link'\n", $output); } - public function provideMigrateHasManyRelations(): array + public static function provideMigrateHasManyRelations(): array { return [ 'no has_many' => [ @@ -734,9 +731,7 @@ public function provideMigrateHasManyRelations(): array ]; } - /** - * @dataProvider provideMigrateHasManyRelations - */ + #[DataProvider('provideMigrateHasManyRelations')] public function testMigrateHasManyRelations( array $hasManyConfig, string $ownerFixture = null, @@ -821,7 +816,7 @@ public function testMigrateHasManyRelations( $this->assertSame($expectedOutput, $output); } - public function providePublishLinks(): array + public static function providePublishLinks(): array { return [ 'skip nothing' => [ @@ -839,9 +834,7 @@ public function providePublishLinks(): array ]; } - /** - * @dataProvider providePublishLinks - */ + #[DataProvider('providePublishLinks')] public function testPublishLinks(bool $shouldPublishLink, bool $shouldPublishLinks): void { // Get the live table before calling publishLinks @@ -935,7 +928,7 @@ public function testPublishLinksUnversioned(): void $this->assertSame($liveLinkContents, $newLiveLinkContents); } - public function provideCheckForBrokenLinks(): array + public static function provideCheckForBrokenLinks(): array { return [ 'no broken links' => [ @@ -947,9 +940,7 @@ public function provideCheckForBrokenLinks(): array ]; } - /** - * @dataProvider provideCheckForBrokenLinks - */ + #[DataProvider('provideCheckForBrokenLinks')] public function testCheckForBrokenLinks(bool $hasBrokenLinks): void { $brokenLinkFixtures = $this->getBrokenLinkFixtures($hasBrokenLinks); @@ -1009,9 +1000,7 @@ public function testCheckForBrokenLinks(bool $hasBrokenLinks): void } } - /** - * @dataProvider provideCheckForBrokenLinks - */ + #[DataProvider('provideCheckForBrokenLinks')] public function testCheckForBrokenLinksWithHtmlOutput(bool $hasBrokenLinks): void { // Make sure we get HTML output diff --git a/tests/php/Traits/AllowedLinkClassesTraitTest.php b/tests/php/Traits/AllowedLinkClassesTraitTest.php index 056aa0b8..da54c13f 100644 --- a/tests/php/Traits/AllowedLinkClassesTraitTest.php +++ b/tests/php/Traits/AllowedLinkClassesTraitTest.php @@ -17,6 +17,7 @@ use SilverStripe\LinkField\Models\SiteTreeLink; use SilverStripe\LinkField\Tests\Controllers\LinkFieldControllerTest\TestPhoneLink; use SilverStripe\ORM\DataObject; +use PHPUnit\Framework\Attributes\DataProvider; class AllowedLinkClassesTraitTest extends SapphireTest { @@ -39,9 +40,7 @@ public function setUp(): void TestPhoneLink::$fail = ''; } - /** - * @dataProvider allowedTypesDataProvider - */ + #[DataProvider('allowedTypesDataProvider')] public function testSetAllowedTypes(array $enabled, array $expected) { $trait = LinkField::create('LinkField'); @@ -53,7 +52,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' => [ @@ -81,9 +80,7 @@ public function allowedTypesDataProvider() : array ]; } - /** - * @dataProvider provideTypesExceptionDataProvider - */ + #[DataProvider('provideTypesExceptionDataProvider')] public function testSetAllowedTypesException(array $enabled) { $trait = LinkField::create('LinkField'); @@ -91,7 +88,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 +103,7 @@ public function provideTypesExceptionDataProvider() : array ]; } - public function sortedTypesDataProvider() : array + public static function sortedTypesDataProvider() : array { return [ 'sort all allowed Link classes' => [ @@ -166,9 +163,7 @@ public function sortedTypesDataProvider() : array ]; } - /** - * @dataProvider sortedTypesDataProvider - */ + #[DataProvider('sortedTypesDataProvider')] public function testGetSortedTypeProps(array $enabled, array $expected, bool $reorder): void { if ($reorder) { @@ -199,7 +194,7 @@ public function testGetTypesPropCanCreate(): void $this->assertFalse($json['testphone']['allowed']); } - public function provideGetTypesProp() : array + public static function provideGetTypesProp() : array { return [ 'SiteTreeLink props' => [ @@ -253,9 +248,7 @@ public function provideGetTypesProp() : array ]; } - /** - * @dataProvider provideGetTypesProp - */ + #[DataProvider('provideGetTypesProp')] public function testGetTypesProp( string $class, string $key,