Skip to content

Commit

Permalink
MNT Use attributes for DataProviders
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Jan 28, 2025
1 parent 917ffbb commit 86cac75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions tests/php/ORM/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
16 changes: 4 additions & 12 deletions tests/php/ORM/MySQLiConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ public function provideQueryThrowsException()
];
}

/**
* @dataProvider provideQueryThrowsException
*/
#[DataProvider('provideQueryThrowsException')]
public function testQueryThrowsDatabaseError(int $reportMode): void
{
$connector = $this->getConnector();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 86cac75

Please sign in to comment.