Skip to content

Commit

Permalink
Migrate to static data providers using rector/rector
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark authored and nicolas-grekas committed Feb 14, 2023
1 parent f3ad7f8 commit d0ec59b
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion Tests/DataCollector/DoctrineDataCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function testSerialization($param, array $types, $expected)
$this->assertTrue($collectedQueries['default'][0]['runnable']);
}

public function paramProvider(): array
public static function paramProvider(): array
{
return [
['some value', [], 'some value'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function testSerialization($param, array $types, $expected, $explainable,
$this->assertSame($runnable, $collectedQueries['default'][0]['runnable']);
}

public function paramProvider(): array
public static function paramProvider(): array
{
return [
['some value', [], 'some value', true],
Expand Down
6 changes: 3 additions & 3 deletions Tests/DependencyInjection/DoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testFixManagersAutoMappingsWithTwoAutomappings()
$method->invoke($this->extension, $emConfigs, $bundles);
}

public function getAutomappingData()
public static function getAutomappingData()
{
return [
[
Expand Down Expand Up @@ -197,7 +197,7 @@ public function testMappingTypeDetection()
$this->assertSame($mappingType, \PHP_VERSION_ID < 80000 ? 'annotation' : 'attribute');
}

public function providerBasicDrivers()
public static function providerBasicDrivers()
{
return [
['doctrine.orm.cache.apc.class', ['type' => 'apc']],
Expand Down Expand Up @@ -276,7 +276,7 @@ public function testUnrecognizedCacheDriverException()
$this->invokeLoadCacheDriver($objectManager, $container, $cacheName);
}

public function providerBundles()
public static function providerBundles()
{
yield ['AnnotationsBundle', 'annotation', '/Entity'];
yield ['AnnotationsOneLineBundle', 'annotation', '/Entity'];
Expand Down
4 changes: 2 additions & 2 deletions Tests/Form/ChoiceList/ORMQueryBuilderLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ public function testEmbeddedIdentifierName()
$loader->getEntitiesByIds('id.value', [1, '', 2, 3, 'foo']);
}

public function provideGuidEntityClasses()
public static function provideGuidEntityClasses()
{
return [
['Symfony\Bridge\Doctrine\Tests\Fixtures\GuidIdEntity'],
['Symfony\Bridge\Doctrine\Tests\Fixtures\UuidIdEntity'],
];
}

public function provideUidEntityClasses()
public static function provideUidEntityClasses()
{
return [
['Symfony\Bridge\Doctrine\Tests\Fixtures\UuidIdEntity'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Form/Type/EntityTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public function testChoiceTranslationDomainIsDisabledByDefault($expanded)
}
}

public function choiceTranslationDomainProvider()
public static function choiceTranslationDomainProvider()
{
return [
[false],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Logger/DbalLoggerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testLog($sql, $params, $logParams)
$dbalLogger->startQuery($sql, $params);
}

public function getLogFixtures()
public static function getLogFixtures()
{
return [
['SQL', null, []],
Expand Down
6 changes: 3 additions & 3 deletions Tests/Middleware/Debug/MiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private function getResourceFromString(string $str)
return $res;
}

public function provideExecuteMethod(): array
public static function provideExecuteMethod(): array
{
return [
'executeStatement' => [
Expand Down Expand Up @@ -173,7 +173,7 @@ public function testWithParamBound(callable $executeMethod)
$this->assertGreaterThan(0, $debug[1]['executionMS']);
}

public function provideEndTransactionMethod(): array
public static function provideEndTransactionMethod(): array
{
return [
'commit' => [
Expand Down Expand Up @@ -223,7 +223,7 @@ public function testTransaction(callable $endTransactionMethod, string $expected
$this->assertGreaterThan(0, $debug[6]['executionMS']);
}

public function provideExecuteAndEndTransactionMethods(): array
public static function provideExecuteAndEndTransactionMethods(): array
{
return [
'commit and exec' => [
Expand Down
2 changes: 1 addition & 1 deletion Tests/PropertyInfo/DoctrineExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testExtractEnum()
$this->assertNull($this->createExtractor()->getTypes(DoctrineEnum::class, 'enumCustom', []));
}

public function typesProvider()
public static function typesProvider()
{
$provider = [
['id', [new Type(Type::BUILTIN_TYPE_INT)]],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Types/UlidTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string
$this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform));
}

public function provideSqlDeclarations(): array
public static function provideSqlDeclarations(): array
{
return [
[new PostgreSQLPlatform(), 'UUID'],
Expand Down
2 changes: 1 addition & 1 deletion Tests/Types/UuidTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testGetGuidTypeDeclarationSQL(AbstractPlatform $platform, string
$this->assertEquals($expectedDeclaration, $this->type->getSqlDeclaration(['length' => 36], $platform));
}

public function provideSqlDeclarations(): array
public static function provideSqlDeclarations(): array
{
return [
[new PostgreSQLPlatform(), 'UUID'],
Expand Down
14 changes: 7 additions & 7 deletions Tests/Validator/Constraints/UniqueEntityValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public function testValidateUniqueness(UniqueEntity $constraint)
->assertRaised();
}

public function provideUniquenessConstraints(): iterable
public static function provideUniquenessConstraints(): iterable
{
yield 'Doctrine style' => [new UniqueEntity([
'message' => 'myMessage',
Expand Down Expand Up @@ -221,7 +221,7 @@ public function testValidateCustomErrorPath(UniqueEntity $constraint)
->assertRaised();
}

public function provideConstraintsWithCustomErrorPath(): iterable
public static function provideConstraintsWithCustomErrorPath(): iterable
{
yield 'Doctrine style' => [new UniqueEntity([
'message' => 'myMessage',
Expand Down Expand Up @@ -282,7 +282,7 @@ public function testValidateUniquenessWithIgnoreNullDisabled(UniqueEntity $const
->assertRaised();
}

public function provideConstraintsWithIgnoreNullDisabled(): iterable
public static function provideConstraintsWithIgnoreNullDisabled(): iterable
{
yield 'Doctrine style' => [new UniqueEntity([
'message' => 'myMessage',
Expand Down Expand Up @@ -331,7 +331,7 @@ public function testNoValidationIfFirstFieldIsNullAndNullValuesAreIgnored(Unique
$this->assertNoViolation();
}

public function provideConstraintsWithIgnoreNullEnabled(): iterable
public static function provideConstraintsWithIgnoreNullEnabled(): iterable
{
yield 'Doctrine style' => [new UniqueEntity([
'message' => 'myMessage',
Expand Down Expand Up @@ -432,7 +432,7 @@ function () use ($entity) {
$this->assertNoViolation();
}

public function provideConstraintsWithCustomRepositoryMethod(): iterable
public static function provideConstraintsWithCustomRepositoryMethod(): iterable
{
yield 'Doctrine style' => [new UniqueEntity([
'message' => 'myMessage',
Expand Down Expand Up @@ -473,7 +473,7 @@ public function testValidateResultTypes($entity1, $result)
$this->assertNoViolation();
}

public function resultTypesProvider()
public static function resultTypesProvider()
{
$entity = new SingleIntIdEntity(1, 'foo');

Expand Down Expand Up @@ -886,7 +886,7 @@ public function testValueCanBeNull()
$this->assertNoViolation();
}

public function resultWithEmptyIterator(): array
public static function resultWithEmptyIterator(): array
{
$entity = new SingleIntIdEntity(1, 'foo');

Expand Down
2 changes: 1 addition & 1 deletion Tests/Validator/DoctrineLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function testClassValidator(bool $expected, string $classValidatorRegexp
$this->assertSame($expected, $doctrineLoader->loadClassMetadata($classMetadata));
}

public function regexpProvider()
public static function regexpProvider()
{
return [
[false, null],
Expand Down

0 comments on commit d0ec59b

Please sign in to comment.