From 2e98072c8b7cb2206d3c8a2f64a1f64446b5f434 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Thu, 29 Feb 2024 00:01:40 +0800 Subject: [PATCH] [11.x] Use PHPUnit Attributes to avoid deprecation notice. (#50291) Signed-off-by: Mior Muhammad Zaki --- tests/Integration/Database/MySql/JoinLateralTest.php | 8 ++++---- tests/Integration/Database/Postgres/JoinLateralTest.php | 8 ++++---- tests/Validation/ValidationEnumRuleTest.php | 9 +++------ 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/tests/Integration/Database/MySql/JoinLateralTest.php b/tests/Integration/Database/MySql/JoinLateralTest.php index 969308ff856c..29770adf97ba 100644 --- a/tests/Integration/Database/MySql/JoinLateralTest.php +++ b/tests/Integration/Database/MySql/JoinLateralTest.php @@ -6,11 +6,11 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Str; +use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; -/** - * @requires extension pdo_mysql - * @requires OS Linux|Darwin - */ +#[RequiresPhpExtension('pdo_mysql')] +#[RequiresOperatingSystemFamily('Linux|Darwin')] class JoinLateralTest extends MySqlTestCase { protected function afterRefreshingDatabase() diff --git a/tests/Integration/Database/Postgres/JoinLateralTest.php b/tests/Integration/Database/Postgres/JoinLateralTest.php index e17f5622efdd..acab3781316b 100644 --- a/tests/Integration/Database/Postgres/JoinLateralTest.php +++ b/tests/Integration/Database/Postgres/JoinLateralTest.php @@ -6,11 +6,11 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; use Illuminate\Support\Str; +use PHPUnit\Framework\Attributes\RequiresOperatingSystemFamily; +use PHPUnit\Framework\Attributes\RequiresPhpExtension; -/** - * @requires extension pdo_pgsql - * @requires OS Linux|Darwin - */ +#[RequiresPhpExtension('pdo_pgsql')] +#[RequiresOperatingSystemFamily('Linux|Darwin')] class JoinLateralTest extends PostgresTestCase { protected function afterRefreshingDatabase() diff --git a/tests/Validation/ValidationEnumRuleTest.php b/tests/Validation/ValidationEnumRuleTest.php index beffc1b314b1..929adb0d4866 100644 --- a/tests/Validation/ValidationEnumRuleTest.php +++ b/tests/Validation/ValidationEnumRuleTest.php @@ -9,6 +9,7 @@ use Illuminate\Validation\Rules\Enum; use Illuminate\Validation\ValidationServiceProvider; use Illuminate\Validation\Validator; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; include_once 'Enums.php'; @@ -97,9 +98,7 @@ public function testValidationPassesForAllCasesUntilEitherOnlyOrExceptIsPassed() $this->assertTrue($v->passes()); } - /** - * @dataProvider conditionalCasesDataProvider - */ + #[DataProvider('conditionalCasesDataProvider')] public function testValidationPassesWhenOnlyCasesProvided( IntegerStatus|int $enum, array|IntegerStatus $only, @@ -118,9 +117,7 @@ public function testValidationPassesWhenOnlyCasesProvided( $this->assertSame($expected, $v->passes()); } - /** - * @dataProvider conditionalCasesDataProvider - */ + #[DataProvider('conditionalCasesDataProvider')] public function testValidationPassesWhenExceptCasesProvided( int|IntegerStatus $enum, array|IntegerStatus $except,