From 86cac75571e776a3799a9cc4b923ed36fe9405c4 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 28 Jan 2025 18:03:05 +1300 Subject: [PATCH] MNT Use attributes for DataProviders --- tests/php/ORM/DataObjectTest.php | 4 +--- tests/php/ORM/MySQLiConnectorTest.php | 16 ++++------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/php/ORM/DataObjectTest.php b/tests/php/ORM/DataObjectTest.php index bb61c5d98a9..953c45b54c1 100644 --- a/tests/php/ORM/DataObjectTest.php +++ b/tests/php/ORM/DataObjectTest.php @@ -2831,9 +2831,7 @@ public function provideExceptionForUniqueIndexViolation() ]; } - /** - * @dataProvider provideExceptionForUniqueIndexViolation - */ + #[DataProvider('provideExceptionForUniqueIndexViolation')] public function testExceptionForUniqueIndexViolation(array $fieldsRecordOne, array $fieldsRecordTwo, string $expectedMessage): void { DataObjectTest\UniqueIndexObject::create($fieldsRecordOne)->write(); diff --git a/tests/php/ORM/MySQLiConnectorTest.php b/tests/php/ORM/MySQLiConnectorTest.php index 08d0e5e6415..7c6628ca532 100644 --- a/tests/php/ORM/MySQLiConnectorTest.php +++ b/tests/php/ORM/MySQLiConnectorTest.php @@ -186,9 +186,7 @@ public function provideQueryThrowsException() ]; } - /** - * @dataProvider provideQueryThrowsException - */ + #[DataProvider('provideQueryThrowsException')] public function testQueryThrowsDatabaseError(int $reportMode): void { $connector = $this->getConnector(); @@ -200,9 +198,7 @@ public function testQueryThrowsDatabaseError(int $reportMode): void $connector->query('force an error with invalid SQL'); } - /** - * @dataProvider provideQueryThrowsException - */ + #[DataProvider('provideQueryThrowsException')] public function testQueryThrowsDuplicateEntryException(int $reportMode): void { $connector = $this->getConnector(); @@ -216,9 +212,7 @@ public function testQueryThrowsDuplicateEntryException(int $reportMode): void $connector->query('INSERT INTO duplicate_entry_table (Title, Name) VALUES (\'My Title\', \'My Name\');'); } - /** - * @dataProvider provideQueryThrowsException - */ + #[DataProvider('provideQueryThrowsException')] public function testPreparedQueryThrowsDatabaseError(int $reportMode): void { $connector = $this->getConnector(); @@ -229,9 +223,7 @@ public function testPreparedQueryThrowsDatabaseError(int $reportMode): void $connector->preparedQuery('force an error with invalid SQL', []); } - /** - * @dataProvider provideQueryThrowsException - */ + #[DataProvider('provideQueryThrowsException')] public function testPreparedQueryThrowsDuplicateEntryException(int $reportMode): void { $connector = $this->getConnector();