Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT Use attributes for DataProviders #11581

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions tests/php/ORM/DataObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2786,7 +2786,7 @@ public function testGetDatabaseBackedField(string $fieldPath, $expected)
$this->assertSame($expected, $databaseBackedField);
}

public function provideExceptionForUniqueIndexViolation()
public static function provideExceptionForUniqueIndexViolation()
{
return [
'violate SingleFieldIndex only' => [
Expand Down 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
18 changes: 5 additions & 13 deletions tests/php/ORM/MySQLiConnectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public function testUtf8mb4UnicodeCollation()
$this->assertEquals('rst', $result[1][0]);
}

public function provideQueryThrowsException()
public static function provideQueryThrowsException()
{
return [
[
Expand All @@ -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
Loading