Skip to content

Commit 0b4af14

Browse files
OskarStarknicolas-grekas
authored andcommitted
Migrate to static data providers using rector/rector
1 parent 4b81c20 commit 0b4af14

30 files changed

+59
-59
lines changed

Tests/ApplicationTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ public function testFindWithAmbiguousAbbreviations($abbreviation, $expectedExcep
431431
$application->find($abbreviation);
432432
}
433433

434-
public function provideAmbiguousAbbreviations()
434+
public static function provideAmbiguousAbbreviations()
435435
{
436436
return [
437437
['f', 'Command "f" is not defined.'],
@@ -547,7 +547,7 @@ public function testDontRunAlternativeCommandName()
547547
$this->assertStringContainsString('Do you want to run "foo" instead? (yes/no) [no]:', $display);
548548
}
549549

550-
public function provideInvalidCommandNamesSingle()
550+
public static function provideInvalidCommandNamesSingle()
551551
{
552552
return [
553553
['foo3:barr'],
@@ -1239,7 +1239,7 @@ public function testAddingAlreadySetDefinitionElementData($def)
12391239
$application->run($input, $output);
12401240
}
12411241

1242-
public function getAddingAlreadySetDefinitionElementData()
1242+
public static function getAddingAlreadySetDefinitionElementData()
12431243
{
12441244
return [
12451245
[new InputArgument('command', InputArgument::REQUIRED)],

Tests/CI/GithubActionReporterTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testAnnotationsFormat(string $type, string $message, string $fil
4343
self::assertSame($expected.\PHP_EOL, $buffer->fetch());
4444
}
4545

46-
public function annotationsFormatProvider(): iterable
46+
public static function annotationsFormatProvider(): iterable
4747
{
4848
yield 'warning' => ['warning', 'A warning', null, null, null, '::warning::A warning'];
4949
yield 'error' => ['error', 'An error', null, null, null, '::error::An error'];

Tests/Command/CommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testInvalidCommandNames($name)
124124
$command->setName($name);
125125
}
126126

127-
public function provideInvalidCommandNames()
127+
public static function provideInvalidCommandNames()
128128
{
129129
return [
130130
[''],
@@ -338,7 +338,7 @@ public function testSetCode()
338338
$this->assertEquals('interact called'.\PHP_EOL.'from the code...'.\PHP_EOL, $tester->getDisplay());
339339
}
340340

341-
public function getSetCodeBindToClosureTests()
341+
public static function getSetCodeBindToClosureTests()
342342
{
343343
return [
344344
[true, 'not bound to the command'],

Tests/Command/CompleteCommandTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function testInputAndCurrentOptionValidation(array $input, ?string $excep
8181
}
8282
}
8383

84-
public function provideInputAndCurrentOptionValues()
84+
public static function provideInputAndCurrentOptionValues()
8585
{
8686
yield [[], 'The "--current" option must be set and it must be an integer'];
8787
yield [['--current' => 'a'], 'The "--current" option must be set and it must be an integer'];
@@ -100,7 +100,7 @@ public function testCompleteCommandName(array $input, array $suggestions)
100100
$this->assertEquals(implode("\n", $suggestions).\PHP_EOL, $this->tester->getDisplay());
101101
}
102102

103-
public function provideCompleteCommandNameInputs()
103+
public static function provideCompleteCommandNameInputs()
104104
{
105105
yield 'empty' => [['bin/console'], ['help', 'list', 'completion', 'hello', 'ahoy']];
106106
yield 'partial' => [['bin/console', 'he'], ['help', 'list', 'completion', 'hello', 'ahoy']];
@@ -117,7 +117,7 @@ public function testCompleteCommandInputDefinition(array $input, array $suggesti
117117
$this->assertEquals(implode("\n", $suggestions).\PHP_EOL, $this->tester->getDisplay());
118118
}
119119

120-
public function provideCompleteCommandInputDefinitionInputs()
120+
public static function provideCompleteCommandInputDefinitionInputs()
121121
{
122122
yield 'definition' => [['bin/console', 'hello', '-'], ['--help', '--quiet', '--verbose', '--version', '--ansi', '--no-ansi', '--no-interaction']];
123123
yield 'custom' => [['bin/console', 'hello'], ['Fabien', 'Robin', 'Wouter']];

Tests/Command/DumpCompletionCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testComplete(array $input, array $expectedSuggestions)
2828
$this->assertSame($expectedSuggestions, $suggestions);
2929
}
3030

31-
public function provideCompletionSuggestions()
31+
public static function provideCompletionSuggestions()
3232
{
3333
yield 'shell' => [
3434
[''],

Tests/Command/HelpCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function testComplete(array $input, array $expectedSuggestions)
8383
$this->assertSame($expectedSuggestions, $suggestions);
8484
}
8585

86-
public function provideCompletionSuggestions()
86+
public static function provideCompletionSuggestions()
8787
{
8888
yield 'option --format' => [
8989
['--format', ''],

Tests/Command/ListCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function testComplete(array $input, array $expectedSuggestions)
127127
$this->assertSame($expectedSuggestions, $suggestions);
128128
}
129129

130-
public function provideCompletionSuggestions()
130+
public static function provideCompletionSuggestions()
131131
{
132132
yield 'option --format' => [
133133
['--format', ''],

Tests/Completion/CompletionInputTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testBind(CompletionInput $input, string $expectedType, ?string $
3939
$this->assertEquals($expectedValue, $input->getCompletionValue(), 'Unexpected value');
4040
}
4141

42-
public function provideBindData()
42+
public static function provideBindData()
4343
{
4444
// option names
4545
yield 'optname-minimal-input' => [CompletionInput::fromTokens(['bin/console', '-'], 1), CompletionInput::TYPE_OPTION_NAME, null, '-'];
@@ -90,7 +90,7 @@ public function testBindWithLastArrayArgument(CompletionInput $input, ?string $e
9090
$this->assertEquals($expectedValue, $input->getCompletionValue(), 'Unexpected value');
9191
}
9292

93-
public function provideBindWithLastArrayArgumentData()
93+
public static function provideBindWithLastArrayArgumentData()
9494
{
9595
yield [CompletionInput::fromTokens(['bin/console'], 1), null];
9696
yield [CompletionInput::fromTokens(['bin/console', 'symfony', 'sensiolabs'], 3), null];
@@ -124,7 +124,7 @@ public function testFromString($inputStr, array $expectedTokens)
124124
$this->assertEquals($expectedTokens, $tokensProperty->getValue($input));
125125
}
126126

127-
public function provideFromStringData()
127+
public static function provideFromStringData()
128128
{
129129
yield ['bin/console cache:clear', ['bin/console', 'cache:clear']];
130130
yield ['bin/console --env prod', ['bin/console', '--env', 'prod']];

Tests/DependencyInjection/AddConsoleCommandPassTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public function testProcessFallsBackToDefaultName()
112112
$this->assertSame(['new-name' => 'with-default-name'], $container->getDefinition('console.command_loader')->getArgument(1));
113113
}
114114

115-
public function visibilityProvider()
115+
public static function visibilityProvider()
116116
{
117117
return [
118118
[true],

Tests/Descriptor/ApplicationDescriptionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function testGetNamespaces(array $expected, array $names)
3131
$this->assertSame($expected, array_keys((new ApplicationDescription($application))->getNamespaces()));
3232
}
3333

34-
public function getNamespacesProvider()
34+
public static function getNamespacesProvider()
3535
{
3636
return [
3737
[['_global'], ['foobar']],

Tests/Formatter/OutputFormatterTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function testInlineStyleOptions(string $tag, string $expected = null, str
185185
}
186186
}
187187

188-
public function provideInlineStyleOptionsCases()
188+
public static function provideInlineStyleOptionsCases()
189189
{
190190
return [
191191
['<unknown=_unknown_>'],
@@ -258,7 +258,7 @@ public function testNotDecoratedFormatter(string $input, string $expectedNonDeco
258258
}
259259
}
260260

261-
public function provideDecoratedAndNonDecoratedOutput()
261+
public static function provideDecoratedAndNonDecoratedOutput()
262262
{
263263
return [
264264
['<error>some error</error>', 'some error', "\033[37;41msome error\033[39;49m"],

Tests/Helper/DumperNativeFallbackTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testInvoke($variable, $primitiveString)
4242
$this->assertSame($primitiveString, $dumper($variable));
4343
}
4444

45-
public function provideVariables()
45+
public static function provideVariables()
4646
{
4747
return [
4848
[null, 'null'],

Tests/Helper/DumperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testInvoke($variable)
4545
$this->assertDumpMatchesFormat($dumper($variable), $variable);
4646
}
4747

48-
public function provideVariables()
48+
public static function provideVariables()
4949
{
5050
return [
5151
[null],

Tests/Helper/HelperTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class HelperTest extends TestCase
1919
{
20-
public function formatTimeProvider()
20+
public static function formatTimeProvider()
2121
{
2222
return [
2323
[0, '< 1 sec'],
@@ -43,7 +43,7 @@ public function formatTimeProvider()
4343
];
4444
}
4545

46-
public function decoratedTextProvider()
46+
public static function decoratedTextProvider()
4747
{
4848
return [
4949
['abc', 'abc'],

Tests/Helper/ProcessHelperTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testPassedCallbackIsExecuted()
4949
$this->assertTrue($executed);
5050
}
5151

52-
public function provideCommandsAndOutput()
52+
public static function provideCommandsAndOutput()
5353
{
5454
$successOutputVerbose = <<<'EOT'
5555
RUN php -r "echo 42;"

Tests/Helper/ProgressBarTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ public function testFormatsWithoutMax($format)
954954
/**
955955
* Provides each defined format.
956956
*/
957-
public function provideFormat(): array
957+
public static function provideFormat(): array
958958
{
959959
return [
960960
['normal'],

Tests/Helper/ProgressIndicatorTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public function testFormats($format)
158158
/**
159159
* Provides each defined format.
160160
*/
161-
public function provideFormat(): array
161+
public static function provideFormat(): array
162162
{
163163
return [
164164
['normal'],

Tests/Helper/QuestionHelperTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ public function testAskWithAutocompleteWithExactMatch()
340340
$this->assertSame('b', $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question));
341341
}
342342

343-
public function getInputs()
343+
public static function getInputs()
344344
{
345345
return [
346346
['$'], // 1 byte character
@@ -536,7 +536,7 @@ public function testAskConfirmation($question, $expected, $default = true)
536536
$this->assertEquals($expected, $dialog->ask($this->createStreamableInputInterfaceMock($inputStream), $this->createOutputInterface(), $question), 'confirmation question should '.($expected ? 'pass' : 'cancel'));
537537
}
538538

539-
public function getAskConfirmationData()
539+
public static function getAskConfirmationData()
540540
{
541541
return [
542542
['', true],
@@ -612,7 +612,7 @@ public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValu
612612
$this->assertSame($expectedValue, $answer);
613613
}
614614

615-
public function simpleAnswerProvider()
615+
public static function simpleAnswerProvider()
616616
{
617617
return [
618618
[0, 'My environment 1'],
@@ -647,7 +647,7 @@ public function testSpecialCharacterChoiceFromMultipleChoiceList($providedAnswer
647647
$this->assertSame($expectedValue, $answer);
648648
}
649649

650-
public function specialCharacterInMultipleChoice()
650+
public static function specialCharacterInMultipleChoice()
651651
{
652652
return [
653653
['.', ['.']],
@@ -697,7 +697,7 @@ public function testAmbiguousChoiceFromChoicelist()
697697
$dialog->ask($this->createStreamableInputInterfaceMock($this->getInputStream("My environment\n")), $this->createOutputInterface(), $question);
698698
}
699699

700-
public function answerProvider()
700+
public static function answerProvider()
701701
{
702702
return [
703703
['env_1', 'env_1'],

Tests/Helper/TableTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function testRenderAddRowsOneByOne($headers, $rows, $style, $expected, $d
8888
$this->assertEquals($expected, $this->getOutputContent($output));
8989
}
9090

91-
public function renderProvider()
91+
public static function renderProvider()
9292
{
9393
$books = [
9494
['99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'],
@@ -1268,7 +1268,7 @@ public function testSetTitle($headerTitle, $footerTitle, $style, $expected)
12681268
$this->assertEquals($expected, $this->getOutputContent($output));
12691269
}
12701270

1271-
public function renderSetTitle()
1271+
public static function renderSetTitle()
12721272
{
12731273
return [
12741274
[
@@ -1481,7 +1481,7 @@ public function testBoxedStyleWithColspan()
14811481
$this->assertSame($expected, $this->getOutputContent($output));
14821482
}
14831483

1484-
public function provideRenderHorizontalTests()
1484+
public static function provideRenderHorizontalTests()
14851485
{
14861486
$headers = ['foo', 'bar', 'baz'];
14871487
$rows = [['one', 'two', 'tree'], ['1', '2', '3']];

Tests/Input/ArgvInputTest.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function testParseOptionsNegatable($input, $options, $expectedOptions, $m
6161
$this->assertEquals($expectedOptions, $input->getOptions(), $message);
6262
}
6363

64-
public function provideOptions()
64+
public static function provideOptions()
6565
{
6666
return [
6767
[
@@ -187,7 +187,7 @@ public function provideOptions()
187187
];
188188
}
189189

190-
public function provideNegatableOptions()
190+
public static function provideNegatableOptions()
191191
{
192192
return [
193193
[
@@ -259,7 +259,7 @@ public function testInvalidInputNegatable($argv, $definition, $expectedException
259259
$input->bind($definition);
260260
}
261261

262-
public function provideInvalidInput()
262+
public static function provideInvalidInput()
263263
{
264264
return [
265265
[
@@ -330,7 +330,7 @@ public function provideInvalidInput()
330330
];
331331
}
332332

333-
public function provideInvalidNegatableInput()
333+
public static function provideInvalidNegatableInput()
334334
{
335335
return [
336336
[
@@ -516,7 +516,7 @@ public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyPara
516516
$this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), '->getParameterOption() returns the expected value');
517517
}
518518

519-
public function provideGetParameterOptionValues()
519+
public static function provideGetParameterOptionValues()
520520
{
521521
return [
522522
[['app/console', 'foo:bar'], '-e', 'default', false, 'default'],

Tests/Input/ArrayInputTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testParseOptions($input, $options, $expectedOptions, $message)
7474
$this->assertEquals($expectedOptions, $input->getOptions(), $message);
7575
}
7676

77-
public function provideOptions()
77+
public static function provideOptions()
7878
{
7979
return [
8080
[
@@ -133,7 +133,7 @@ public function testParseInvalidInput($parameters, $definition, $expectedExcepti
133133
new ArrayInput($parameters, $definition);
134134
}
135135

136-
public function provideInvalidInput()
136+
public static function provideInvalidInput()
137137
{
138138
return [
139139
[

Tests/Input/InputDefinitionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public function testGetSynopsis(InputDefinition $definition, $expectedSynopsis,
367367
$this->assertEquals($expectedSynopsis, $definition->getSynopsis(), $message ? '->getSynopsis() '.$message : '');
368368
}
369369

370-
public function getGetSynopsisData()
370+
public static function getGetSynopsisData()
371371
{
372372
return [
373373
[new InputDefinition([new InputOption('foo')]), '[--foo]', 'puts optional options in square brackets'],

Tests/Input/StringInputTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function testInputOptionWithGivenString()
4343
$this->assertEquals('bar', $input->getOption('foo'));
4444
}
4545

46-
public function getTokenizeData()
46+
public static function getTokenizeData()
4747
{
4848
return [
4949
['', [], '->tokenize() parses an empty string'],

0 commit comments

Comments
 (0)