From 063bd6c8afc256f6a0252274499be4b57c7b5a0f Mon Sep 17 00:00:00 2001 From: Benjamin Morel Date: Wed, 7 Feb 2024 00:23:13 +0100 Subject: [PATCH] Migrate to PHPUnit attributes --- tests/Types/PhoneNumberTypeTest.php | 17 +++++------------ tests/TypesFunctionalTest.php | 17 +++++------------ 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/tests/Types/PhoneNumberTypeTest.php b/tests/Types/PhoneNumberTypeTest.php index 8d1da04..14c2de4 100644 --- a/tests/Types/PhoneNumberTypeTest.php +++ b/tests/Types/PhoneNumberTypeTest.php @@ -9,6 +9,7 @@ use Doctrine\DBAL\Platforms\SQLitePlatform; use Doctrine\DBAL\Types\ConversionException; use Doctrine\DBAL\Types\Type; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use stdClass; @@ -19,9 +20,7 @@ private function getPhoneNumberType(): PhoneNumberType return Type::getType('PhoneNumber'); } - /** - * @dataProvider providerConvertToDatabaseValue - */ + #[DataProvider('providerConvertToDatabaseValue')] public function testConvertToDatabaseValue(?PhoneNumber $value, ?string $expectedValue): void { $type = $this->getPhoneNumberType(); @@ -39,9 +38,7 @@ public static function providerConvertToDatabaseValue(): array ]; } - /** - * @dataProvider providerConvertToDatabaseValueWithInvalidValue - */ + #[DataProvider('providerConvertToDatabaseValueWithInvalidValue')] public function testConvertToDatabaseValueWithInvalidValue(mixed $value): void { $type = $this->getPhoneNumberType(); @@ -61,9 +58,7 @@ public static function providerConvertToDatabaseValueWithInvalidValue(): array ]; } - /** - * @dataProvider providerConvertToPHPValue - */ + #[DataProvider('providerConvertToPHPValue')] public function testConvertToPHPValue(?string $value): void { $type = $this->getPhoneNumberType(); @@ -86,9 +81,7 @@ public static function providerConvertToPHPValue(): array ]; } - /** - * @dataProvider providerConvertToPHPValueWithInvalidValue - */ + #[DataProvider('providerConvertToPHPValueWithInvalidValue')] public function testConvertToPHPValueWithInvalidValue(mixed $value): void { $type = $this->getPhoneNumberType(); diff --git a/tests/TypesFunctionalTest.php b/tests/TypesFunctionalTest.php index 3f738ba..ffc286b 100644 --- a/tests/TypesFunctionalTest.php +++ b/tests/TypesFunctionalTest.php @@ -8,6 +8,7 @@ use Brick\PhoneNumber\PhoneNumber; use Doctrine\DBAL\Connection; use Doctrine\ORM\Tools\SchemaTool; +use PHPUnit\Framework\Attributes\Depends; class TypesFunctionalTest extends AbstractFunctionalTestCase { @@ -30,9 +31,7 @@ public function testCreateSchema(): Connection return $connection; } - /** - * @depends testCreateSchema - */ + #[Depends('testCreateSchema')] public function testSaveNull(Connection $connection): Connection { $em = self::createEntityManager($connection); @@ -49,9 +48,7 @@ public function testSaveNull(Connection $connection): Connection return $connection; } - /** - * @depends testSaveNull - */ + #[Depends('testSaveNull')] public function testLoadNull(Connection $connection): void { $em = self::createEntityManager($connection); @@ -62,9 +59,7 @@ public function testLoadNull(Connection $connection): void self::assertNull($entity->phoneNumber); } - /** - * @depends testCreateSchema - */ + #[Depends('testCreateSchema')] public function testSaveValues(Connection $connection): Connection { $em = self::createEntityManager($connection); @@ -83,9 +78,7 @@ public function testSaveValues(Connection $connection): Connection return $connection; } - /** - * @depends testSaveValues - */ + #[Depends('testSaveValues')] public function testLoadValues(Connection $connection): void { $em = self::createEntityManager($connection);