Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Migrate to static data providers using rector/rector #48668

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

Merged
merged 1 commit into from
Feb 14, 2023
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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
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
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
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
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
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
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 src/Symfony/Bridge/Doctrine/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 src/Symfony/Bridge/Doctrine/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
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testFormat(array $record, $expectedMessage)
self::assertSame($expectedMessage, $formatter->format($record));
}

public function providerFormatTests(): array
public static function providerFormatTests(): array
{
$currentDateTime = new \DateTime();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testVerbosityMapping($verbosity, $level, $isHandling, array $map
$this->assertFalse($handler->handle($infoRecord), 'The handler finished handling the log.');
}

public function provideVerbosityMappingTests()
public static function provideVerbosityMappingTests()
{
return [
[OutputInterface::VERBOSITY_QUIET, Logger::ERROR, true],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testIsActivated($url, $record, $expected)
self::assertEquals($expected, $strategy->isHandlerActivated($record));
}

public function isActivatedProvider(): array
public static function isActivatedProvider(): array
{
return [
['/test', ['level' => Logger::ERROR], true],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testIsActivated(string $url, array $record, bool $expected)
self::assertEquals($expected, $strategy->isHandlerActivated($record));
}

public function isActivatedProvider(): array
public static function isActivatedProvider(): array
{
return [
['/test', ['level' => Logger::DEBUG], false],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testDatetimeFormat(array $record, $expectedTimestamp)
self::assertSame($expectedTimestamp, $records[0]['timestamp']);
}

public function providerDatetimeFormatTests(): array
public static function providerDatetimeFormatTests(): array
{
$record = self::getRecord();

Expand All @@ -56,7 +56,7 @@ public function testDatetimeRfc3339Format(array $record, $expectedTimestamp)
self::assertSame($expectedTimestamp, $records[0]['timestamp_rfc3339']);
}

public function providerDatetimeRfc3339FormatTests(): array
public static function providerDatetimeRfc3339FormatTests(): array
{
$record = self::getRecord();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function testItCanTellWhetherToDisplayAStackTrace()
$this->assertTrue($configuration->shouldDisplayStackTrace('interesting'));
}

public function provideItCanBeDisabled(): array
public static function provideItCanBeDisabled(): array
{
return [
['disabled', false],
Expand Down Expand Up @@ -248,7 +248,7 @@ public function testToleratesForIndividualGroups(string $deprecationsHelper, arr
}
}

public function provideDataForToleratesForGroup() {
public static function provideDataForToleratesForGroup() {

yield 'total threshold not reached' => ['max[total]=1', [
'unsilenced' => 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public function testItMutesOnlySpecificErrorMessagesWhenTheCallingCodeIsInPhpuni
$this->assertSame($muted, $deprecation->isMuted());
}

public function mutedProvider()
public static function mutedProvider()
{
yield 'not from phpunit, and not a whitelisted message' => [
false,
Expand Down Expand Up @@ -147,7 +147,7 @@ public function testItTakesMutesDeprecationFromPhpUnitFiles()
$this->assertTrue($deprecation->isMuted());
}

public function providerGetTypeDetectsSelf()
public static function providerGetTypeDetectsSelf()
{
return [
'not_from_vendors_file' => [Deprecation::TYPE_SELF, '', 'MyClass1', __FILE__],
Expand Down Expand Up @@ -182,7 +182,7 @@ public function testGetTypeDetectsSelf(string $expectedType, string $message, st
$this->assertSame($expectedType, $deprecation->getType());
}

public function providerGetTypeUsesRightTrace()
public static function providerGetTypeUsesRightTrace()
{
$vendorDir = self::getVendorDir();
$fakeTrace = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testCorrectAssigning(Definition $definition, $access)
$this->assertStringMatchesFormat('%A$this->'.$access.'[\'foo\'] = %A', $code);
}

public function getPrivatePublicDefinitions()
public static function getPrivatePublicDefinitions()
{
return [
[
Expand Down Expand Up @@ -164,7 +164,7 @@ protected function createProxy(\$class, \Closure \$factory)
$this->assertSame(123, @$foo->dynamicProp);
}

public function getProxyCandidates(): array
public static function getProxyCandidates(): array
{
$definitions = [
[new Definition(__CLASS__), true],
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Tests/AppVariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testDebug($debugFlag)
$this->assertEquals($debugFlag, $this->appVariable->getDebug());
}

public function debugDataProvider()
public static function debugDataProvider()
{
return [
'debug on' => [true],
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testDebugTemplateName(array $input, string $output, array $paths
$this->assertStringMatchesFormat($output, $tester->getDisplay(true));
}

public function getDebugTemplateNameTestData()
public static function getDebugTemplateNameTestData()
{
$defaultPaths = [
'templates/' => null,
Expand Down Expand Up @@ -315,7 +315,7 @@ public function testComplete(array $input, array $expectedSuggestions)
$this->assertSame($expectedSuggestions, $suggestions);
}

public function provideCompletionSuggestions(): iterable
public static function provideCompletionSuggestions(): iterable
{
yield 'name' => [['email'], []];
yield 'option --format' => [['--format', ''], ['text', 'json']];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Tests/Command/LintCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function testComplete(array $input, array $expectedSuggestions)
$this->assertSame($expectedSuggestions, $tester->complete($input));
}

public function provideCompletionSuggestions()
public static function provideCompletionSuggestions()
{
yield 'option' => [['--format', ''], ['txt', 'json', 'github']];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Extension/CodeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ public function testGettingMethodAbbreviation($method, $abbr)
$this->assertEquals($this->getExtension()->abbrMethod($method), $abbr);
}

public function getClassNameProvider(): array
public static function getClassNameProvider(): array
{
return [
['F\Q\N\Foo', '<abbr title="F\Q\N\Foo">Foo</abbr>'],
['Bare', '<abbr title="Bare">Bare</abbr>'],
];
}

public function getMethodNameProvider(): array
public static function getMethodNameProvider(): array
{
return [
['F\Q\N\Foo::Method', '<abbr title="F\Q\N\Foo">Foo</abbr>::Method()'],
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bridge/Twig/Tests/Extension/DumpExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testDumpTag($template, $debug, $expectedOutput, $expectedDumped)
$this->assertSame($expectedDumped, $dumped);
}

public function getDumpTags()
public static function getDumpTags()
{
return [
['A{% dump %}B', true, 'AB', []],
Expand Down Expand Up @@ -88,7 +88,7 @@ public function testDump($context, $args, $expectedOutput, $debug = true)
$this->assertEquals($expectedOutput, $dump);
}

public function getDumpArgs()
public static function getDumpArgs()
{
return [
[[], [], '', false],
Expand Down
Loading