Skip to content

Commit c8336db

Browse files
OskarStarknicolas-grekas
authored andcommitted
Migrate to static data providers using rector/rector
1 parent 7432eef commit c8336db

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

Tests/Command/LintCommandTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function testComplete(array $input, array $expectedSuggestions)
179179
$this->assertSame($expectedSuggestions, $tester->complete($input));
180180
}
181181

182-
public function provideCompletionSuggestions()
182+
public static function provideCompletionSuggestions()
183183
{
184184
yield 'option' => [['--format', ''], ['txt', 'json', 'github']];
185185
}

Tests/DumperTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function testEscapedEscapeSequencesInQuotedScalar($input, $expected)
225225
$this->assertSameData($input, $this->parser->parse($expected));
226226
}
227227

228-
public function getEscapeSequences()
228+
public static function getEscapeSequences()
229229
{
230230
return [
231231
'empty string' => ['', "''"],
@@ -275,7 +275,7 @@ public function testDumpObjectAsMap($object, $expected)
275275
$this->assertSameData($expected, $this->parser->parse($yaml, Yaml::PARSE_OBJECT_FOR_MAP));
276276
}
277277

278-
public function objectAsMapProvider()
278+
public static function objectAsMapProvider()
279279
{
280280
$tests = [];
281281

Tests/InlineTest.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testParsePhpConstants($yaml, $value)
5656
$this->assertSame($value, $actual);
5757
}
5858

59-
public function getTestsForParsePhpConstants()
59+
public static function getTestsForParsePhpConstants()
6060
{
6161
return [
6262
['!php/const Symfony\Component\Yaml\Yaml::PARSE_CONSTANT', Yaml::PARSE_CONSTANT],
@@ -195,7 +195,7 @@ public function testParseReferences($yaml, $expected)
195195
$this->assertSame($expected, Inline::parse($yaml, 0, $references));
196196
}
197197

198-
public function getDataForParseReferences()
198+
public static function getDataForParseReferences()
199199
{
200200
return [
201201
'scalar' => ['*var', 'var-value'],
@@ -245,7 +245,7 @@ public function testParseUnquotedScalarStartingWithReservedIndicator($indicator)
245245
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
246246
}
247247

248-
public function getReservedIndicators()
248+
public static function getReservedIndicators()
249249
{
250250
return [['@'], ['`']];
251251
}
@@ -261,7 +261,7 @@ public function testParseUnquotedScalarStartingWithScalarIndicator($indicator)
261261
Inline::parse(sprintf('{ foo: %sfoo }', $indicator));
262262
}
263263

264-
public function getScalarIndicators()
264+
public static function getScalarIndicators()
265265
{
266266
return [['|'], ['>'], ['%']];
267267
}
@@ -274,7 +274,7 @@ public function testIsHash($array, $expected)
274274
$this->assertSame($expected, Inline::isHash($array));
275275
}
276276

277-
public function getDataForIsHash()
277+
public static function getDataForIsHash()
278278
{
279279
return [
280280
[[], false],
@@ -284,7 +284,7 @@ public function getDataForIsHash()
284284
];
285285
}
286286

287-
public function getTestsForParse()
287+
public static function getTestsForParse()
288288
{
289289
return [
290290
['', ''],
@@ -370,7 +370,7 @@ public function getTestsForParse()
370370
];
371371
}
372372

373-
public function getTestsForParseWithMapObjects()
373+
public static function getTestsForParseWithMapObjects()
374374
{
375375
return [
376376
['', ''],
@@ -451,7 +451,7 @@ public function getTestsForParseWithMapObjects()
451451
];
452452
}
453453

454-
public function getTestsForDump()
454+
public static function getTestsForDump()
455455
{
456456
return [
457457
['null', null],
@@ -549,7 +549,7 @@ public function testParseTimestampAsDateTimeObject(string $yaml, int $year, int
549549
$this->assertSame($timezone, $date->format('O'));
550550
}
551551

552-
public function getTimestampTests(): array
552+
public static function getTimestampTests(): array
553553
{
554554
return [
555555
'canonical' => ['2001-12-15T02:59:43.1Z', 2001, 12, 15, 2, 59, 43, 100000, '+0000'],
@@ -591,7 +591,7 @@ public function testDumpUnitEnum()
591591
$this->assertSame("!php/const Symfony\Component\Yaml\Tests\Fixtures\FooUnitEnum::BAR", Inline::dump(FooUnitEnum::BAR));
592592
}
593593

594-
public function getDateTimeDumpTests()
594+
public static function getDateTimeDumpTests()
595595
{
596596
$tests = [];
597597

@@ -612,7 +612,7 @@ public function testParseBinaryData($data)
612612
$this->assertSame('Hello world', Inline::parse($data));
613613
}
614614

615-
public function getBinaryData()
615+
public static function getBinaryData()
616616
{
617617
return [
618618
'enclosed with double quotes' => ['!!binary "SGVsbG8gd29ybGQ="'],
@@ -632,7 +632,7 @@ public function testParseInvalidBinaryData($data, $expectedMessage)
632632
Inline::parse($data);
633633
}
634634

635-
public function getInvalidBinaryData()
635+
public static function getInvalidBinaryData()
636636
{
637637
return [
638638
'length not a multiple of four' => ['!!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'],
@@ -674,7 +674,7 @@ public function testParseMissingMappingValueAsNull($yaml, $expected)
674674
$this->assertSame($expected, Inline::parse($yaml));
675675
}
676676

677-
public function getTestsForNullValues()
677+
public static function getTestsForNullValues()
678678
{
679679
return [
680680
'null before closing curly brace' => ['{foo:}', ['foo' => null]],
@@ -697,7 +697,7 @@ public function testImplicitStringCastingOfMappingKeysIsDeprecated($yaml, $expec
697697
$this->assertSame($expected, Inline::parse($yaml));
698698
}
699699

700-
public function getNotPhpCompatibleMappingKeyData()
700+
public static function getNotPhpCompatibleMappingKeyData()
701701
{
702702
return [
703703
'boolean-true' => ['{true: "foo"}', ['true' => 'foo']],
@@ -776,7 +776,7 @@ public function testParseOctalNumbers($expected, $yaml)
776776
self::assertSame($expected, Inline::parse($yaml));
777777
}
778778

779-
public function getTestsForOctalNumbers()
779+
public static function getTestsForOctalNumbers()
780780
{
781781
return [
782782
'positive octal number' => [28, '0o34'],
@@ -797,7 +797,7 @@ public function testParseOctalNumbersYaml11Notation(int $expected, string $yaml,
797797
self::assertSame($expected, Inline::parse($yaml));
798798
}
799799

800-
public function getTestsForOctalNumbersYaml11Notation()
800+
public static function getTestsForOctalNumbersYaml11Notation()
801801
{
802802
return [
803803
'positive octal number' => [28, '034', '0o34'],
@@ -818,7 +818,7 @@ public function testPhpObjectWithEmptyValue($expected, $value)
818818
$this->assertSame($expected, Inline::parse($value, Yaml::PARSE_OBJECT));
819819
}
820820

821-
public function phpObjectTagWithEmptyValueProvider()
821+
public static function phpObjectTagWithEmptyValueProvider()
822822
{
823823
return [
824824
[false, '!php/object'],
@@ -842,7 +842,7 @@ public function testPhpConstTagWithEmptyValue($expected, $value)
842842
$this->assertSame($expected, Inline::parse($value, Yaml::PARSE_CONSTANT));
843843
}
844844

845-
public function phpConstTagWithEmptyValueProvider()
845+
public static function phpConstTagWithEmptyValueProvider()
846846
{
847847
return [
848848
['', '!php/const'],
@@ -894,7 +894,7 @@ public function testUnquotedExclamationMarkThrows(string $value)
894894
Inline::parse($value);
895895
}
896896

897-
public function unquotedExclamationMarkThrowsProvider()
897+
public static function unquotedExclamationMarkThrowsProvider()
898898
{
899899
return [
900900
['!'],
@@ -926,7 +926,7 @@ public function testQuotedExclamationMark($expected, string $value)
926926
}
927927

928928
// This provider should stay consistent with unquotedExclamationMarkThrowsProvider
929-
public function quotedExclamationMarkProvider()
929+
public static function quotedExclamationMarkProvider()
930930
{
931931
return [
932932
['!', '"!"'],
@@ -956,7 +956,7 @@ public function testParseIdeographicSpace(string $yaml, string $expected)
956956
$this->assertSame($expected, Inline::parse($yaml));
957957
}
958958

959-
public function ideographicSpaceProvider(): array
959+
public static function ideographicSpaceProvider(): array
960960
{
961961
return [
962962
["\u{3000}", ' '],

Tests/ParserTest.php

+16-16
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function testTabsAsIndentationInYaml(string $given, string $expectedMessa
144144
$this->parser->parse($given);
145145
}
146146

147-
public function invalidIndentation(): array
147+
public static function invalidIndentation(): array
148148
{
149149
return [
150150
[
@@ -189,7 +189,7 @@ public function testValidTokenSeparation(string $given, array $expected)
189189
$this->assertSameData($expected, $actual);
190190
}
191191

192-
public function validTokenSeparators(): array
192+
public static function validTokenSeparators(): array
193193
{
194194
return [
195195
[
@@ -222,7 +222,7 @@ public function testEndOfTheDocumentMarker()
222222
$this->assertEquals('foo', $this->parser->parse($yaml));
223223
}
224224

225-
public function getBlockChompingTests()
225+
public static function getBlockChompingTests()
226226
{
227227
$tests = [];
228228

@@ -586,7 +586,7 @@ public function testObjectForMap($yaml, $expected)
586586
$this->assertSameData($expected, $this->parser->parse($yaml, $flags));
587587
}
588588

589-
public function getObjectForMapTests()
589+
public static function getObjectForMapTests()
590590
{
591591
$tests = [];
592592

@@ -833,7 +833,7 @@ public function testNonStringFollowedByCommentEmbeddedInMapping()
833833
$this->assertSame($expected, $this->parser->parse($yaml));
834834
}
835835

836-
public function getParseExceptionNotAffectedMultiLineStringLastResortParsing()
836+
public static function getParseExceptionNotAffectedMultiLineStringLastResortParsing()
837837
{
838838
$tests = [];
839839

@@ -975,7 +975,7 @@ public function testParseExceptionOnDuplicate($input, $duplicateKey, $lineNumber
975975
Yaml::parse($input);
976976
}
977977

978-
public function getParseExceptionOnDuplicateData()
978+
public static function getParseExceptionOnDuplicateData()
979979
{
980980
$tests = [];
981981

@@ -1280,7 +1280,7 @@ public function testCommentLikeStringsAreNotStrippedInBlockScalars($yaml, $expec
12801280
$this->assertSame($expectedParserResult, $this->parser->parse($yaml));
12811281
}
12821282

1283-
public function getCommentLikeStringInScalarBlockData()
1283+
public static function getCommentLikeStringInScalarBlockData()
12841284
{
12851285
$tests = [];
12861286

@@ -1465,7 +1465,7 @@ public function testParseBinaryData($data)
14651465
$this->assertSame(['data' => 'Hello world'], $this->parser->parse($data));
14661466
}
14671467

1468-
public function getBinaryData()
1468+
public static function getBinaryData()
14691469
{
14701470
return [
14711471
'enclosed with double quotes' => ['data: !!binary "SGVsbG8gd29ybGQ="'],
@@ -1497,7 +1497,7 @@ public function testParseInvalidBinaryData($data, $expectedMessage)
14971497
$this->parser->parse($data);
14981498
}
14991499

1500-
public function getInvalidBinaryData()
1500+
public static function getInvalidBinaryData()
15011501
{
15021502
return [
15031503
'length not a multiple of four' => ['data: !!binary "SGVsbG8d29ybGQ="', '/The normalized base64 encoded data \(data without whitespace characters\) length must be a multiple of four \(\d+ bytes given\)/'],
@@ -1563,7 +1563,7 @@ public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yam
15631563
$this->parser->parse($yaml);
15641564
}
15651565

1566-
public function parserThrowsExceptionWithCorrectLineNumberProvider()
1566+
public static function parserThrowsExceptionWithCorrectLineNumberProvider()
15671567
{
15681568
return [
15691569
[
@@ -1720,7 +1720,7 @@ public function testParseQuotedStringContainingEscapedQuotationCharacters(string
17201720
$this->assertSame($expected, $this->parser->parse($yaml));
17211721
}
17221722

1723-
public function escapedQuotationCharactersInQuotedStrings()
1723+
public static function escapedQuotationCharactersInQuotedStrings()
17241724
{
17251725
return [
17261726
'single quoted string' => [
@@ -1778,7 +1778,7 @@ public function testParseMultiLineMappingValue($yaml, $expected, $parseError)
17781778
$this->assertSame($expected, $this->parser->parse($yaml));
17791779
}
17801780

1781-
public function multiLineDataProvider()
1781+
public static function multiLineDataProvider()
17821782
{
17831783
$tests = [];
17841784

@@ -1845,7 +1845,7 @@ public function testInlineNotationSpanningMultipleLines($expected, string $yaml)
18451845
$this->assertSame($expected, $this->parser->parse($yaml));
18461846
}
18471847

1848-
public function inlineNotationSpanningMultipleLinesProvider(): array
1848+
public static function inlineNotationSpanningMultipleLinesProvider(): array
18491849
{
18501850
return [
18511851
'mapping' => [
@@ -2234,7 +2234,7 @@ public function testCustomTagSupport($expected, $yaml)
22342234
$this->assertSameData($expected, $this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS));
22352235
}
22362236

2237-
public function taggedValuesProvider()
2237+
public static function taggedValuesProvider()
22382238
{
22392239
return [
22402240
'scalars' => [
@@ -2658,7 +2658,7 @@ public function testDetectCircularReferences($yaml)
26582658
$this->parser->parse($yaml, Yaml::PARSE_CUSTOM_TAGS);
26592659
}
26602660

2661-
public function circularReferenceProvider()
2661+
public static function circularReferenceProvider()
26622662
{
26632663
$tests = [];
26642664

@@ -2698,7 +2698,7 @@ public function testParseIndentedMappings($yaml, $expected)
26982698
$this->assertSame($expected, $this->parser->parse($yaml));
26992699
}
27002700

2701-
public function indentedMappingData()
2701+
public static function indentedMappingData()
27022702
{
27032703
$tests = [];
27042704

0 commit comments

Comments
 (0)