From 6def72bd2281f5449565c1de8b8d3c22825af97c Mon Sep 17 00:00:00 2001 From: Composite PHP Date: Mon, 23 Dec 2024 22:35:50 +0000 Subject: [PATCH] Adapt tests to php 8.4 --- phpunit.xml | 5 ++ tests/AbstractEntityTest.php | 9 +-- tests/ColumnBuilderTest.php | 75 +++++++------------- tests/Columns/ArrayColumnTest.php | 9 +-- tests/Columns/BackedEnumColumnTest.php | 9 +-- tests/Columns/BackedIntEnumColumnTest.php | 9 +-- tests/Columns/BackedStringEnumColumnTest.php | 9 +-- tests/Columns/BoolColumnTest.php | 9 +-- tests/Columns/CastableColumnTest.php | 9 +-- tests/Columns/CollectionColumnTest.php | 21 ++---- tests/Columns/DateTimeColumnTest.php | 13 ++-- tests/Columns/EntityColumnTest.php | 9 +-- tests/Columns/EntityListColumnTest.php | 17 ++--- tests/Columns/FloatColumnTest.php | 9 +-- tests/Columns/IntegerColumnTest.php | 9 +-- tests/Columns/ObjectColumnTest.php | 9 +-- tests/Columns/StringColumnTest.php | 9 +-- tests/Columns/UnitEnumColumnTest.php | 9 +-- tests/Columns/UuidColumnTest.php | 9 +-- 19 files changed, 90 insertions(+), 167 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 868ab25..7afc066 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,6 +3,11 @@ xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="vendor/autoload.php" executionOrder="depends,defects" beStrictAboutOutputDuringTests="true" failOnRisky="true" failOnWarning="true" colors="true" cacheDirectory=".phpunit.cache" requireCoverageMetadata="false" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerErrors="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" + displayDetailsOnPhpunitDeprecations="true" beStrictAboutCoverageMetadata="true"> diff --git a/tests/AbstractEntityTest.php b/tests/AbstractEntityTest.php index eaf60d9..65e9ddd 100644 --- a/tests/AbstractEntityTest.php +++ b/tests/AbstractEntityTest.php @@ -5,6 +5,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Helpers\DateTimeHelper; use Composite\Entity\Tests\TestStand\TestSubEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class AbstractEntityTest extends \PHPUnit\Framework\TestCase { @@ -76,9 +77,7 @@ public function __construct( ]; } - /** - * @dataProvider hydration_dataProvider - */ + #[DataProvider('hydration_dataProvider')] public function test_hydration(AbstractEntity $entity, array $expected): void { $actual = $entity->toArray(); @@ -131,9 +130,7 @@ public static function changedColumns_dataProvider(): array ]; } - /** - * @dataProvider changedColumns_dataProvider - */ + #[DataProvider('changedColumns_dataProvider')] public function test_changedColumns(array $createData, array $expectedChangedColumns): void { $entity = TestStand\TestAutoIncrementEntity::fromArray($createData); diff --git a/tests/ColumnBuilderTest.php b/tests/ColumnBuilderTest.php index fb42e63..7bbf470 100644 --- a/tests/ColumnBuilderTest.php +++ b/tests/ColumnBuilderTest.php @@ -7,6 +7,7 @@ use Composite\Entity\Attributes\SkipSerialization; use Composite\Entity\Columns\AbstractColumn; use Composite\Entity\Tests\TestStand\TestSubEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class ColumnBuilderTest extends \PHPUnit\Framework\TestCase { @@ -51,9 +52,7 @@ public function __construct( ]; } - /** - * @dataProvider visibility_dataProvider - */ + #[DataProvider('visibility_dataProvider')] public function test_visibility(AbstractEntity $entity, array $expected): void { $schema = $entity::schema(); @@ -90,9 +89,7 @@ public static function type_dataProvider(): array ]; } - /** - * @dataProvider type_dataProvider - */ + #[DataProvider('type_dataProvider')] public function test_type(AbstractEntity $entity, array $expected): void { $schema = $entity::schema(); @@ -124,9 +121,7 @@ public function __construct( ]; } - /** - * @dataProvider hasDefaultValue_dataProvider - */ + #[DataProvider('hasDefaultValue_dataProvider')] public function test_hasDefaultValue(AbstractEntity $class, array $expected): void { $schema = $class::schema(); @@ -168,9 +163,7 @@ public static function defaultValue_dataProvider(): array ]; } - /** - * @dataProvider defaultValue_dataProvider - */ + #[DataProvider('defaultValue_dataProvider')] public function test_defaultValue(AbstractEntity $entity, array $expected): void { $schema = $entity::schema(); @@ -214,9 +207,7 @@ public function __construct( ]; } - /** - * @dataProvider isNullable_dataProvider - */ + #[DataProvider('isNullable_dataProvider')] public function test_isNullable(AbstractEntity $class, array $expected): void { $schema = $class::schema(); @@ -226,29 +217,6 @@ public function test_isNullable(AbstractEntity $class, array $expected): void } } - public static function isReadOnly_dataProvider(): array - { - return [ - [ - 'class' => new class extends AbstractEntity { - public string $foo2 = 'foo'; - public readonly ?string $bar2; - - public function __construct( - public string $foo1 = 'foo', - public readonly ?string $bar1 = null, - ) {} - }, - 'expected' => [ - 'foo1' => false, - 'bar1' => true, - 'foo2' => false, - 'bar2' => true, - ] - ], - ]; - } - public static function isConstructorPromoted_dataProvider(): array { return [ @@ -272,9 +240,7 @@ public function __construct( ]; } - /** - * @dataProvider isConstructorPromoted_dataProvider - */ + #[DataProvider('isConstructorPromoted_dataProvider')] public function test_isConstructorPromoted(AbstractEntity $entity, array $expected): void { $schema = $entity::schema(); @@ -284,11 +250,26 @@ public function test_isConstructorPromoted(AbstractEntity $entity, array $expect } } - /** - * @dataProvider isReadOnly_dataProvider - */ - public function test_isReadOnly(AbstractEntity $entity, array $expected): void + public function test_isReadOnly(): void { + $entity = new class extends AbstractEntity { + public string $foo2 = 'foo'; + public readonly ?string $bar2; + + public function __construct( + public string $foo1 = 'foo', + public readonly ?string $bar1 = null, + ) { + } + }; + + $expected = [ + 'foo1' => false, + 'bar1' => true, + 'foo2' => false, + 'bar2' => true, + ]; + $schema = $entity::schema(); foreach ($expected as $name => $expectedIsReadOnly) { $this->assertNotNull($schema->getColumn($name)); @@ -321,9 +302,7 @@ public static function notSupported_dataProvider(): array ]; } - /** - * @dataProvider notSupported_dataProvider - */ + #[DataProvider('notSupported_dataProvider')] public function test_notSupported(AbstractEntity $entity): void { try { diff --git a/tests/Columns/ArrayColumnTest.php b/tests/Columns/ArrayColumnTest.php index 45291f3..d2da778 100644 --- a/tests/Columns/ArrayColumnTest.php +++ b/tests/Columns/ArrayColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Exceptions\EntityException; +use PHPUnit\Framework\Attributes\DataProvider; final class ArrayColumnTest extends \PHPUnit\Framework\TestCase { @@ -45,9 +46,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?array $expected): void { $class = new class extends AbstractEntity { @@ -81,9 +80,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/BackedEnumColumnTest.php b/tests/Columns/BackedEnumColumnTest.php index d25c2ee..89ed638 100644 --- a/tests/Columns/BackedEnumColumnTest.php +++ b/tests/Columns/BackedEnumColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestBackedStringEnum; +use PHPUnit\Framework\Attributes\DataProvider; final class BackedEnumColumnTest extends \PHPUnit\Framework\TestCase { @@ -41,9 +42,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestBackedStringEnum $expected): void { $class = new class extends AbstractEntity { @@ -73,9 +72,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/BackedIntEnumColumnTest.php b/tests/Columns/BackedIntEnumColumnTest.php index 7d978c7..76f7fd3 100644 --- a/tests/Columns/BackedIntEnumColumnTest.php +++ b/tests/Columns/BackedIntEnumColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestBackedIntEnum; +use PHPUnit\Framework\Attributes\DataProvider; final class BackedIntEnumColumnTest extends \PHPUnit\Framework\TestCase { @@ -45,9 +46,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestBackedIntEnum $expected): void { $class = new class extends AbstractEntity { @@ -77,9 +76,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/BackedStringEnumColumnTest.php b/tests/Columns/BackedStringEnumColumnTest.php index eaac187..ceb9e45 100644 --- a/tests/Columns/BackedStringEnumColumnTest.php +++ b/tests/Columns/BackedStringEnumColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestBackedStringEnum; +use PHPUnit\Framework\Attributes\DataProvider; final class BackedStringEnumColumnTest extends \PHPUnit\Framework\TestCase { @@ -45,9 +46,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestBackedStringEnum $expected): void { $class = new class extends AbstractEntity { @@ -77,9 +76,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/BoolColumnTest.php b/tests/Columns/BoolColumnTest.php index ca5fc3e..0465190 100644 --- a/tests/Columns/BoolColumnTest.php +++ b/tests/Columns/BoolColumnTest.php @@ -3,6 +3,7 @@ namespace Composite\Entity\Tests\Columns; use Composite\Entity\AbstractEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class BoolColumnTest extends \PHPUnit\Framework\TestCase { @@ -60,9 +61,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?bool $expected): void { $class = new class extends AbstractEntity { @@ -92,9 +91,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/CastableColumnTest.php b/tests/Columns/CastableColumnTest.php index 6638e2d..6dd4527 100644 --- a/tests/Columns/CastableColumnTest.php +++ b/tests/Columns/CastableColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestCastableIntObject; +use PHPUnit\Framework\Attributes\DataProvider; final class CastableColumnTest extends \PHPUnit\Framework\TestCase { @@ -35,9 +36,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestCastableIntObject $expected): void { $class = new class extends AbstractEntity { @@ -65,9 +64,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/CollectionColumnTest.php b/tests/Columns/CollectionColumnTest.php index 60b6465..69b1ce1 100644 --- a/tests/Columns/CollectionColumnTest.php +++ b/tests/Columns/CollectionColumnTest.php @@ -8,10 +8,11 @@ use Composite\Entity\Tests\TestStand\TestEntityCollection; use Composite\Entity\Tests\TestStand\TestStringCollection; use Doctrine\Common\Collections\ArrayCollection; +use PHPUnit\Framework\Attributes\DataProvider; final class CollectionColumnTest extends \PHPUnit\Framework\TestCase { - public static function entityCast_dataProvider(): array + public static function cast_dataProvider(): array { $sub1 = new TestEntity(str: 'foo'); $sub2 = new TestEntity(str: 'bar'); @@ -51,9 +52,7 @@ public static function entityCast_dataProvider(): array ]; } - /** - * @dataProvider entityCast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_entityCast(mixed $value, ?TestEntityCollection $expected): void { $class = new class extends AbstractEntity { @@ -87,9 +86,7 @@ public static function stringCast_dataProvider(): array ]; } - /** - * @dataProvider stringCast_dataProvider - */ + #[DataProvider('stringCast_dataProvider')] public function test_stringCast(mixed $value, ?TestStringCollection $expected): void { $class = new class extends AbstractEntity { @@ -101,7 +98,7 @@ public function __construct( $this->compareCollections($expected, $entity->column); } - public static function entityUncast_dataProvider(): array + public static function uncast_dataProvider(): array { $sub1 = new TestEntity(str: 'foo'); $sub2 = new TestEntity(str: 'bar'); @@ -127,9 +124,7 @@ public static function entityUncast_dataProvider(): array ]; } - /** - * @dataProvider entityUncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_entityUncast(?TestEntityCollection $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { @@ -166,9 +161,7 @@ public static function stringUncast_dataProvider(): array ]; } - /** - * @dataProvider stringUncast_dataProvider - */ + #[DataProvider('stringUncast_dataProvider')] public function test_stringUncast(?TestStringCollection $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/DateTimeColumnTest.php b/tests/Columns/DateTimeColumnTest.php index 89c67b6..1bf045e 100644 --- a/tests/Columns/DateTimeColumnTest.php +++ b/tests/Columns/DateTimeColumnTest.php @@ -6,6 +6,7 @@ use Composite\Entity\Attributes\Date; use Composite\Entity\Helpers\DateTimeHelper; use DateTimeImmutable; +use PHPUnit\Framework\Attributes\DataProvider; final class DateTimeColumnTest extends \PHPUnit\Framework\TestCase { @@ -72,9 +73,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?\DateTime $dateTime, ?\DateTimeImmutable $dateTimeImmutable): void { $class = new class extends AbstractEntity { @@ -103,9 +102,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { @@ -173,9 +170,7 @@ public static function date_dataProvider(): array ]; } - /** - * @dataProvider date_dataProvider - */ + #[DataProvider('date_dataProvider')] public function test_dateUncast(mixed $value, ?string $expected): void { $class = new class() extends AbstractEntity { diff --git a/tests/Columns/EntityColumnTest.php b/tests/Columns/EntityColumnTest.php index 098d52a..4d860d2 100644 --- a/tests/Columns/EntityColumnTest.php +++ b/tests/Columns/EntityColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestSubEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class EntityColumnTest extends \PHPUnit\Framework\TestCase { @@ -46,9 +47,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestSubEntity $expected): void { $class = new class extends AbstractEntity { @@ -76,9 +75,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/EntityListColumnTest.php b/tests/Columns/EntityListColumnTest.php index 4d100bf..60f8d7d 100644 --- a/tests/Columns/EntityListColumnTest.php +++ b/tests/Columns/EntityListColumnTest.php @@ -9,6 +9,7 @@ use Composite\Entity\Tests\TestStand\TestEntity; use Composite\Entity\Tests\TestStand\TestSubEntity; use Composite\Entity\Tests\TestStand\TestUnitEnum; +use PHPUnit\Framework\Attributes\DataProvider; final class EntityListColumnTest extends \PHPUnit\Framework\TestCase { @@ -63,9 +64,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?array $expected): void { $class = new class extends AbstractEntity { @@ -102,9 +101,7 @@ public static function castWithKey_dataProvider(): array ]; } - /** - * @dataProvider castWIthKey_dataProvider - */ + #[DataProvider('castWithKey_dataProvider')] public function test_castWithKey(mixed $value, ?array $expected): void { $class = new class extends AbstractEntity { @@ -181,9 +178,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { @@ -217,9 +212,7 @@ public static function uncastWithKey_dataProvider(): array ]; } - /** - * @dataProvider uncastWithKey_dataProvider - */ + #[DataProvider('uncastWithKey_dataProvider')] public function test_uncastWithKey(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/FloatColumnTest.php b/tests/Columns/FloatColumnTest.php index a89b0b9..2ef8586 100644 --- a/tests/Columns/FloatColumnTest.php +++ b/tests/Columns/FloatColumnTest.php @@ -3,6 +3,7 @@ namespace Composite\Entity\Tests\Columns; use Composite\Entity\AbstractEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class FloatColumnTest extends \PHPUnit\Framework\TestCase { @@ -60,9 +61,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?float $expected): void { $class = new class extends AbstractEntity { @@ -100,9 +99,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/IntegerColumnTest.php b/tests/Columns/IntegerColumnTest.php index 98315bd..d7c9867 100644 --- a/tests/Columns/IntegerColumnTest.php +++ b/tests/Columns/IntegerColumnTest.php @@ -3,6 +3,7 @@ namespace Composite\Entity\Tests\Columns; use Composite\Entity\AbstractEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class IntegerColumnTest extends \PHPUnit\Framework\TestCase { @@ -64,9 +65,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?int $expected): void { $class = new class extends AbstractEntity { @@ -100,9 +99,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/ObjectColumnTest.php b/tests/Columns/ObjectColumnTest.php index 48ef195..d2d261d 100644 --- a/tests/Columns/ObjectColumnTest.php +++ b/tests/Columns/ObjectColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Exceptions\EntityException; +use PHPUnit\Framework\Attributes\DataProvider; final class ObjectColumnTest extends \PHPUnit\Framework\TestCase { @@ -48,9 +49,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?object $expected): void { $class = new class extends AbstractEntity { @@ -87,9 +86,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/StringColumnTest.php b/tests/Columns/StringColumnTest.php index 87b7bcc..bcfaae2 100644 --- a/tests/Columns/StringColumnTest.php +++ b/tests/Columns/StringColumnTest.php @@ -3,6 +3,7 @@ namespace Composite\Entity\Tests\Columns; use Composite\Entity\AbstractEntity; +use PHPUnit\Framework\Attributes\DataProvider; final class StringColumnTest extends \PHPUnit\Framework\TestCase { @@ -32,9 +33,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?string $expected): void { $class = new class extends AbstractEntity { @@ -68,9 +67,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/UnitEnumColumnTest.php b/tests/Columns/UnitEnumColumnTest.php index f086cdf..da343d3 100644 --- a/tests/Columns/UnitEnumColumnTest.php +++ b/tests/Columns/UnitEnumColumnTest.php @@ -4,6 +4,7 @@ use Composite\Entity\AbstractEntity; use Composite\Entity\Tests\TestStand\TestUnitEnum; +use PHPUnit\Framework\Attributes\DataProvider; final class UnitEnumColumnTest extends \PHPUnit\Framework\TestCase { @@ -41,9 +42,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?TestUnitEnum $expected): void { $class = new class extends AbstractEntity { @@ -73,9 +72,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(mixed $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity { diff --git a/tests/Columns/UuidColumnTest.php b/tests/Columns/UuidColumnTest.php index 4ce36b9..e536646 100644 --- a/tests/Columns/UuidColumnTest.php +++ b/tests/Columns/UuidColumnTest.php @@ -3,6 +3,7 @@ namespace Composite\Entity\Tests\Columns; use Composite\Entity\AbstractEntity; +use PHPUnit\Framework\Attributes\DataProvider; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; @@ -30,9 +31,7 @@ public static function cast_dataProvider(): array ]; } - /** - * @dataProvider cast_dataProvider - */ + #[DataProvider('cast_dataProvider')] public function test_cast(mixed $value, ?UuidInterface $expected): void { $class = new class extends AbstractEntity { @@ -62,9 +61,7 @@ public static function uncast_dataProvider(): array ]; } - /** - * @dataProvider uncast_dataProvider - */ + #[DataProvider('uncast_dataProvider')] public function test_uncast(?UuidInterface $value, mixed $expected): void { $entity = new class($value) extends AbstractEntity {