Skip to content

Commit

Permalink
DX: rename data providers (#7058)
Browse files Browse the repository at this point in the history
  • Loading branch information
kubawerlos committed Jun 16, 2023
1 parent 376a987 commit 617aaba
Show file tree
Hide file tree
Showing 99 changed files with 337 additions and 337 deletions.
4 changes: 2 additions & 2 deletions tests/AbstractDoctrineAnnotationFixerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class AbstractDoctrineAnnotationFixerTestCase extends AbstractFixerTest
/**
* @param array<mixed> $configuration
*
* @dataProvider provideInvalidConfigurationCases
* @dataProvider provideConfigureWithInvalidConfigurationCases
*/
public function testConfigureWithInvalidConfiguration(array $configuration): void
{
Expand All @@ -34,7 +34,7 @@ public function testConfigureWithInvalidConfiguration(array $configuration): voi
$this->fixer->configure($configuration);
}

public static function provideInvalidConfigurationCases(): array
public static function provideConfigureWithInvalidConfigurationCases(): array
{
return [
[['foo' => 'bar']],
Expand Down
4 changes: 2 additions & 2 deletions tests/AutoReview/DocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
final class DocumentationTest extends TestCase
{
/**
* @dataProvider provideFixerCases
* @dataProvider provideFixerDocumentationFileIsUpToDateCases
*/
public function testFixerDocumentationFileIsUpToDate(FixerInterface $fixer): void
{
Expand Down Expand Up @@ -92,7 +92,7 @@ static function (array $matches) use ($actual): string {
self::assertSame($expected, $actual);
}

public static function provideFixerCases(): iterable
public static function provideFixerDocumentationFileIsUpToDateCases(): iterable
{
foreach (self::getFixers() as $fixer) {
yield $fixer->getName() => [$fixer];
Expand Down
8 changes: 4 additions & 4 deletions tests/AutoReview/FixerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testFixersPriority(): void
/**
* @param string[] $edges
*
* @dataProvider provideFixersPriorityCasesHaveIntegrationCases
* @dataProvider provideFixersPriorityCasesHaveIntegrationTestCases
*/
public function testFixersPriorityCasesHaveIntegrationTest(string $fixerName, array $edges): void
{
Expand Down Expand Up @@ -137,15 +137,15 @@ public function testFixersPriorityCasesHaveIntegrationTest(string $fixerName, ar
self::assertCount(0, $missingIntegrationsTests, sprintf("There shall be an integration test. How do you know that priority set up is good, if there is no integration test to check it?\nMissing:\n- %s", implode("\n- ", $missingIntegrationsTests)));
}

public static function provideFixersPriorityCasesHaveIntegrationCases(): iterable
public static function provideFixersPriorityCasesHaveIntegrationTestCases(): iterable
{
foreach (self::getFixersPriorityGraph() as $fixerName => $edges) {
yield $fixerName => [$fixerName, $edges];
}
}

/**
* @dataProvider provideIntegrationTestFilesCases
* @dataProvider providePriorityIntegrationTestFilesAreListedAsPriorityCasesCases
*/
public function testPriorityIntegrationTestFilesAreListedAsPriorityCases(\SplFileInfo $file): void
{
Expand All @@ -168,7 +168,7 @@ public function testPriorityIntegrationTestFilesAreListedAsPriorityCases(\SplFil
);
}

public static function provideIntegrationTestFilesCases(): iterable
public static function providePriorityIntegrationTestFilesAreListedAsPriorityCasesCases(): iterable
{
foreach (new \DirectoryIterator(self::getIntegrationPriorityDirectory()) as $candidate) {
if (!$candidate->isDot()) {
Expand Down
12 changes: 6 additions & 6 deletions tests/AutoReview/ProjectCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function testThatClassesWithoutTestsVarIsProper(): void
}

/**
* @dataProvider provideSrcConcreteClassCases
* @dataProvider provideThatSrcClassHaveTestClassCases
*/
public function testThatSrcClassHaveTestClass(string $className): void
{
Expand All @@ -96,7 +96,7 @@ public function testThatSrcClassHaveTestClass(string $className): void
}

/**
* @dataProvider provideSrcClassesNotAbuseInterfacesCases
* @dataProvider provideThatSrcClassesNotAbuseInterfacesCases
*/
public function testThatSrcClassesNotAbuseInterfaces(string $className): void
{
Expand Down Expand Up @@ -374,7 +374,7 @@ public function testThatTestClassCoversAreCorrect(string $testClassName): void
}

/**
* @dataProvider provideClassesWherePregFunctionsAreForbiddenCases
* @dataProvider provideThereIsNoPregFunctionUsedDirectlyCases
*/
public function testThereIsNoPregFunctionUsedDirectly(string $className): void
{
Expand Down Expand Up @@ -591,7 +591,7 @@ static function (string $item): array {
);
}

public static function provideSrcClassesNotAbuseInterfacesCases(): array
public static function provideThatSrcClassesNotAbuseInterfacesCases(): array
{
return array_map(
static function (string $item): array {
Expand Down Expand Up @@ -637,7 +637,7 @@ static function (string $item): array {
);
}

public static function provideSrcConcreteClassCases(): array
public static function provideThatSrcClassHaveTestClassCases(): array
{
return array_map(
static fn (string $item): array => [$item],
Expand Down Expand Up @@ -667,7 +667,7 @@ public static function provideTestClassCases(): iterable
yield from self::$testClassCases;
}

public static function provideClassesWherePregFunctionsAreForbiddenCases(): array
public static function provideThereIsNoPregFunctionUsedDirectlyCases(): array
{
return array_map(
static fn (string $item): array => [$item],
Expand Down
6 changes: 3 additions & 3 deletions tests/AutoReview/TransformerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function testTransformerPriority(TransformerInterface $first, Transformer
}

/**
* @dataProvider provideTransformerCases
* @dataProvider provideTransformerPriorityIsListedCases
*/
public function testTransformerPriorityIsListed(TransformerInterface $transformer): void
{
Expand Down Expand Up @@ -74,7 +74,7 @@ public static function provideTransformerPriorityCases(): array
{
$transformers = [];

foreach (self::provideTransformerCases() as [$transformer]) {
foreach (self::provideTransformerPriorityIsListedCases() as [$transformer]) {
$transformers[$transformer->getName()] = $transformer;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ public static function provideTransformerPriorityCases(): array
/**
* @return TransformerInterface[]
*/
public static function provideTransformerCases(): array
public static function provideTransformerPriorityIsListedCases(): array
{
static $transformersArray = null;

Expand Down
4 changes: 2 additions & 2 deletions tests/Cache/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function testFromJsonThrowsInvalidArgumentExceptionIfJsonIsInvalid(): voi
/**
* @param array<string, mixed> $data
*
* @dataProvider provideMissingDataCases
* @dataProvider provideFromJsonThrowsInvalidArgumentExceptionIfJsonIsMissingKeyCases
*/
public function testFromJsonThrowsInvalidArgumentExceptionIfJsonIsMissingKey(array $data): void
{
Expand All @@ -119,7 +119,7 @@ public function testFromJsonThrowsInvalidArgumentExceptionIfJsonIsMissingKey(arr
Cache::fromJson($json);
}

public static function provideMissingDataCases(): array
public static function provideFromJsonThrowsInvalidArgumentExceptionIfJsonIsMissingKeyCases(): array
{
$data = [
'php' => '7.1.2',
Expand Down
20 changes: 10 additions & 10 deletions tests/Console/ConfigurationResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function testResolveConfigFileSpecified(): void
}

/**
* @dataProvider provideResolveConfigFileDefaultCases
* @dataProvider provideResolveConfigFileChooseFileCases
*/
public function testResolveConfigFileChooseFile(string $expectedFile, string $expectedClass, string $path, ?string $cwdPath = null): void
{
Expand All @@ -195,7 +195,7 @@ public function testResolveConfigFileChooseFile(string $expectedFile, string $ex
self::assertInstanceOf($expectedClass, $resolver->getConfig());
}

public static function provideResolveConfigFileDefaultCases(): array
public static function provideResolveConfigFileChooseFileCases(): array
{
$dirBase = self::getFixtureDir();

Expand Down Expand Up @@ -285,7 +285,7 @@ public function testResolveConfigFileChooseFileWithPathArrayAndConfig(): void
* @param array<int, string> $paths
* @param array<int, string> $expectedPaths
*
* @dataProvider providePathCases
* @dataProvider provideResolvePathCases
*/
public function testResolvePath(array $paths, string $cwd, array $expectedPaths): void
{
Expand All @@ -298,7 +298,7 @@ public function testResolvePath(array $paths, string $cwd, array $expectedPaths)
self::assertSame($expectedPaths, $resolver->getPath());
}

public static function providePathCases(): iterable
public static function provideResolvePathCases(): iterable
{
yield [
['Command'],
Expand Down Expand Up @@ -328,7 +328,7 @@ public static function providePathCases(): iterable
/**
* @param array<string> $paths
*
* @dataProvider provideEmptyPathCases
* @dataProvider provideRejectInvalidPathCases
*/
public function testRejectInvalidPath(array $paths, string $expectedMessage): void
{
Expand All @@ -344,7 +344,7 @@ public function testRejectInvalidPath(array $paths, string $expectedMessage): vo
$resolver->getPath();
}

public static function provideEmptyPathCases(): iterable
public static function provideRejectInvalidPathCases(): iterable
{
yield [
[''],
Expand Down Expand Up @@ -961,7 +961,7 @@ public function testResolveRulesWithOption(): void
/**
* @param string[] $rules
*
* @dataProvider provideRenamedRulesCases
* @dataProvider provideResolveRenamedRulesWithUnknownRulesCases
*/
public function testResolveRenamedRulesWithUnknownRules(string $expectedMessage, array $rules): void
{
Expand All @@ -972,7 +972,7 @@ public function testResolveRenamedRulesWithUnknownRules(string $expectedMessage,
$resolver->getRules();
}

public static function provideRenamedRulesCases(): iterable
public static function provideResolveRenamedRulesWithUnknownRulesCases(): iterable
{
yield 'with config' => [
'The rules contain unknown fixers: "blank_line_before_return" is renamed (did you mean "blank_line_before_statement"? (note: use configuration "[\'statements\' => [\'return\']]")).
Expand Down Expand Up @@ -1069,7 +1069,7 @@ public function testResolveCommandLineInputOverridesDefault(): void
/**
* @param null|bool|string $diffConfig
*
* @dataProvider provideDifferCases
* @dataProvider provideResolveDifferCases
*/
public function testResolveDiffer(string $expected, $diffConfig): void
{
Expand All @@ -1080,7 +1080,7 @@ public function testResolveDiffer(string $expected, $diffConfig): void
self::assertInstanceOf($expected, $resolver->getDiffer());
}

public static function provideDifferCases(): array
public static function provideResolveDifferCases(): array
{
return [
[
Expand Down
6 changes: 3 additions & 3 deletions tests/Console/Output/ErrorOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
final class ErrorOutputTest extends TestCase
{
/**
* @dataProvider provideTestCases
* @dataProvider provideErrorOutputCases
*/
public function testErrorOutput(Error $error, int $verbosityLevel, int $lineNumber, int $exceptionLineNumber, string $process): void
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public function testErrorOutput(Error $error, int $verbosityLevel, int $lineNumb
'
PhpCsFixer\Tests\Console\Output\ErrorOutputTest::getErrorAndLineNumber()
in %s at line %d
PhpCsFixer\Tests\Console\Output\ErrorOutputTest::provideTestCases()
PhpCsFixer\Tests\Console\Output\ErrorOutputTest::provideErrorOutputCases()
ReflectionMethod->invoke()
',
__FILE__,
Expand All @@ -81,7 +81,7 @@ public function testErrorOutput(Error $error, int $verbosityLevel, int $lineNumb
self::assertStringStartsWith($startWith, $displayed);
}

public static function provideTestCases(): array
public static function provideErrorOutputCases(): array
{
$lineNumber = __LINE__;
[$exceptionLineNumber, $error] = self::getErrorAndLineNumber(); // note: keep call and __LINE__ separated with one line break
Expand Down
4 changes: 2 additions & 2 deletions tests/Console/SelfUpdate/NewVersionCheckerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testGetLatestVersion(): void
}

/**
* @dataProvider provideLatestVersionOfMajorCases
* @dataProvider provideGetLatestVersionOfMajorCases
*/
public function testGetLatestVersionOfMajor(int $majorVersion, ?string $expectedVersion): void
{
Expand All @@ -42,7 +42,7 @@ public function testGetLatestVersionOfMajor(int $majorVersion, ?string $expected
self::assertSame($expectedVersion, $checker->getLatestVersionOfMajor($majorVersion));
}

public static function provideLatestVersionOfMajorCases(): array
public static function provideGetLatestVersionOfMajorCases(): array
{
return [
[1, 'v1.13.2'],
Expand Down
4 changes: 2 additions & 2 deletions tests/Differ/DiffConsoleFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
final class DiffConsoleFormatterTest extends TestCase
{
/**
* @dataProvider provideTestCases
* @dataProvider provideDiffConsoleFormatterCases
*/
public function testDiffConsoleFormatter(string $expected, bool $isDecoratedOutput, string $template, string $diff, string $lineTemplate): void
{
Expand All @@ -38,7 +38,7 @@ public function testDiffConsoleFormatter(string $expected, bool $isDecoratedOutp
);
}

public static function provideTestCases(): array
public static function provideDiffConsoleFormatterCases(): array
{
return [
[
Expand Down
8 changes: 4 additions & 4 deletions tests/DocBlock/AnnotationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public function testGetTagsWithTypes(): void
/**
* @param NamespaceUseAnalysis[] $namespaceUses
*
* @dataProvider provideTypeExpressionCases
* @dataProvider provideGetTypeExpressionCases
*/
public function testGetTypeExpression(string $line, ?NamespaceAnalysis $namespace, array $namespaceUses, ?string $expectedCommonType): void
{
Expand All @@ -554,7 +554,7 @@ public function testGetTypeExpression(string $line, ?NamespaceAnalysis $namespac
self::assertSame($expectedCommonType, $result->getCommonType());
}

public static function provideTypeExpressionCases(): iterable
public static function provideGetTypeExpressionCases(): iterable
{
$appNamespace = new NamespaceAnalysis('App', 'App', 0, 999, 0, 999);
$useTraversable = new NamespaceUseAnalysis('Traversable', 'Traversable', false, 0, 999, NamespaceUseAnalysis::TYPE_CLASS);
Expand All @@ -567,15 +567,15 @@ public static function provideTypeExpressionCases(): iterable
}

/**
* @dataProvider provideGetVariableCases
* @dataProvider provideGetVariableNameCases
*/
public function testGetVariableName(string $line, ?string $expectedVariableName): void
{
$annotation = new Annotation([new Line($line)]);
self::assertSame($expectedVariableName, $annotation->getVariableName());
}

public static function provideGetVariableCases(): iterable
public static function provideGetVariableNameCases(): iterable
{
yield ['* @param int $foo', '$foo'];

Expand Down
8 changes: 4 additions & 4 deletions tests/DocBlock/DocBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function testIsMultiLIne(): void
}

/**
* @dataProvider provideDocBlocksToConvertToMultiLineCases
* @dataProvider provideMakeMultiLIneCases
*/
public function testMakeMultiLIne(string $inputDocBlock, string $outputDocBlock = null, string $indent = '', string $newLine = "\n"): void
{
Expand All @@ -170,7 +170,7 @@ public function testMakeMultiLIne(string $inputDocBlock, string $outputDocBlock
self::assertSame($outputDocBlock, $doc->getContent());
}

public static function provideDocBlocksToConvertToMultiLineCases(): array
public static function provideMakeMultiLIneCases(): array
{
return [
'It keeps a multi line doc block as is' => [
Expand Down Expand Up @@ -201,7 +201,7 @@ public static function provideDocBlocksToConvertToMultiLineCases(): array
}

/**
* @dataProvider provideDocBlocksToConvertToSingleLineCases
* @dataProvider provideMakeSingleLineCases
*/
public function testMakeSingleLine(string $inputDocBlock, string $outputDocBlock = null): void
{
Expand All @@ -215,7 +215,7 @@ public function testMakeSingleLine(string $inputDocBlock, string $outputDocBlock
self::assertSame($outputDocBlock, $doc->getContent());
}

public static function provideDocBlocksToConvertToSingleLineCases(): array
public static function provideMakeSingleLineCases(): array
{
return [
'It keeps a single line doc block as is' => [
Expand Down
Loading

0 comments on commit 617aaba

Please sign in to comment.