Skip to content

Commit 1b94a1c

Browse files
OskarStarknicolas-grekas
authored andcommitted
Migrate to static data providers using rector/rector
1 parent dffbaf4 commit 1b94a1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+171
-171
lines changed

Tests/ConstraintValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testFormatValue($expected, $value, $format = 0)
2727
$this->assertSame($expected, (new TestFormatValueConstraintValidator())->formatValueProxy($value, $format));
2828
}
2929

30-
public function formatValueProvider()
30+
public static function formatValueProvider()
3131
{
3232
$defaultTimezone = date_default_timezone_get();
3333
date_default_timezone_set('Europe/Moscow'); // GMT+3

Tests/ConstraintViolationListTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function testFindByCodes($code, $violationsCount)
146146
$this->assertCount($violationsCount, $specificErrors);
147147
}
148148

149-
public function findByCodesProvider()
149+
public static function findByCodesProvider()
150150
{
151151
return [
152152
['code1', 2],

Tests/Constraints/AllValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testWalkMultipleConstraints($array)
7777
$this->assertNoViolation();
7878
}
7979

80-
public function getValidArguments()
80+
public static function getValidArguments()
8181
{
8282
return [
8383
[[5, 6, 7]],

Tests/Constraints/AtLeastOneOfValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function testValidCombinations($value, $constraints)
5656
$this->assertCount(0, Validation::createValidator()->validate($value, new AtLeastOneOf($constraints)));
5757
}
5858

59-
public function getValidCombinations()
59+
public static function getValidCombinations()
6060
{
6161
return [
6262
['symfony', [
@@ -125,7 +125,7 @@ public function testInvalidCombinationsWithCustomMessage($value, $constraints)
125125
$this->assertEquals(new ConstraintViolation('foo', 'foo', [], $value, '', $value, null, AtLeastOneOf::AT_LEAST_ONE_OF_ERROR, $atLeastOneOf), $violations->get(0));
126126
}
127127

128-
public function getInvalidCombinations()
128+
public static function getInvalidCombinations()
129129
{
130130
return [
131131
['symphony', [

Tests/Constraints/BicValidatorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ public function testValidBics($bic)
197197
$this->assertNoViolation();
198198
}
199199

200-
public function getValidBics()
200+
public static function getValidBics()
201201
{
202202
// http://formvalidation.io/validators/bic/
203203
return [
@@ -243,7 +243,7 @@ public function testInvalidBicsNamed($bic, $code)
243243
->assertRaised();
244244
}
245245

246-
public function getInvalidBics()
246+
public static function getInvalidBics()
247247
{
248248
return [
249249
['DEUTD', Bic::INVALID_LENGTH_ERROR],
@@ -287,7 +287,7 @@ public function testValidBicSpecialCases(string $bic, string $iban)
287287
$this->assertNoViolation();
288288
}
289289

290-
public function getValidBicSpecialCases()
290+
public static function getValidBicSpecialCases()
291291
{
292292
// FR related special cases
293293
yield ['BNPAGFGX', 'FR14 2004 1010 0505 0001 3M02 606'];

Tests/Constraints/BlankValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function testInvalidValues($value, $valueAsString)
5353
->assertRaised();
5454
}
5555

56-
public function getInvalidValues()
56+
public static function getInvalidValues()
5757
{
5858
return [
5959
['foobar', '"foobar"'],

Tests/Constraints/CardSchemeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testInvalidNumberNamedArguments()
9090
->assertRaised();
9191
}
9292

93-
public function getValidNumbers()
93+
public static function getValidNumbers()
9494
{
9595
return [
9696
['AMEX', '378282246310005'],
@@ -145,7 +145,7 @@ public function getValidNumbers()
145145
];
146146
}
147147

148-
public function getInvalidNumbers()
148+
public static function getInvalidNumbers()
149149
{
150150
return [
151151
['VISA', '42424242424242424242', CardScheme::INVALID_FORMAT_ERROR],

Tests/Constraints/ChoiceValidatorTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testValidChoiceArray(Choice $constraint)
8484
$this->assertNoViolation();
8585
}
8686

87-
public function provideConstraintsWithChoicesArray(): iterable
87+
public static function provideConstraintsWithChoicesArray(): iterable
8888
{
8989
yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar']])];
9090
yield 'Doctrine default option' => [new Choice(['value' => ['foo', 'bar']])];
@@ -105,7 +105,7 @@ public function testValidChoiceCallbackFunction(Choice $constraint)
105105
$this->assertNoViolation();
106106
}
107107

108-
public function provideConstraintsWithCallbackFunction(): iterable
108+
public static function provideConstraintsWithCallbackFunction(): iterable
109109
{
110110
yield 'doctrine style, namespaced function' => [new Choice(['callback' => __NAMESPACE__.'\choice_callback'])];
111111
yield 'doctrine style, closure' => [new Choice([
@@ -156,7 +156,7 @@ public function testMultipleChoices(Choice $constraint)
156156
$this->assertNoViolation();
157157
}
158158

159-
public function provideConstraintsWithMultipleTrue(): iterable
159+
public static function provideConstraintsWithMultipleTrue(): iterable
160160
{
161161
yield 'Doctrine style' => [new Choice([
162162
'choices' => ['foo', 'bar', 'baz'],
@@ -185,7 +185,7 @@ public function testInvalidChoice(Choice $constraint)
185185
->assertRaised();
186186
}
187187

188-
public function provideConstraintsWithMessage(): iterable
188+
public static function provideConstraintsWithMessage(): iterable
189189
{
190190
yield 'Doctrine style' => [new Choice(['choices' => ['foo', 'bar'], 'message' => 'myMessage'])];
191191

@@ -227,7 +227,7 @@ public function testInvalidChoiceMultiple(Choice $constraint)
227227
->assertRaised();
228228
}
229229

230-
public function provideConstraintsWithMultipleMessage(): iterable
230+
public static function provideConstraintsWithMultipleMessage(): iterable
231231
{
232232
yield 'Doctrine style' => [new Choice([
233233
'choices' => ['foo', 'bar'],
@@ -263,7 +263,7 @@ public function testTooFewChoices(Choice $constraint)
263263
->assertRaised();
264264
}
265265

266-
public function provideConstraintsWithMin(): iterable
266+
public static function provideConstraintsWithMin(): iterable
267267
{
268268
yield 'Doctrine style' => [new Choice([
269269
'choices' => ['foo', 'bar', 'moo', 'maa'],
@@ -301,7 +301,7 @@ public function testTooManyChoices(Choice $constraint)
301301
->assertRaised();
302302
}
303303

304-
public function provideConstraintsWithMax(): iterable
304+
public static function provideConstraintsWithMax(): iterable
305305
{
306306
yield 'Doctrine style' => [new Choice([
307307
'choices' => ['foo', 'bar', 'moo', 'maa'],

Tests/Constraints/CidrTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testWithInvalidMinMaxValues(string $ipVersion, int $netmaskMin,
9090
]);
9191
}
9292

93-
public function getInvalidMinMaxValues(): array
93+
public static function getInvalidMinMaxValues(): array
9494
{
9595
return [
9696
[Ip::ALL, -1, 23],
@@ -108,7 +108,7 @@ public function getInvalidMinMaxValues(): array
108108
];
109109
}
110110

111-
public function getValidMinMaxValues(): array
111+
public static function getValidMinMaxValues(): array
112112
{
113113
return [
114114
[Ip::ALL, 0, 23],

Tests/Constraints/CidrValidatorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function testWrongVersion(string $cidr, string $version)
135135
->assertRaised();
136136
}
137137

138-
public function getWithInvalidIps(): array
138+
public static function getWithInvalidIps(): array
139139
{
140140
return [
141141
['0/20'],
@@ -164,7 +164,7 @@ public function getWithInvalidIps(): array
164164
];
165165
}
166166

167-
public function getValid(): array
167+
public static function getValid(): array
168168
{
169169
return [
170170
['127.0.0.0/32', Ip::ALL],
@@ -198,7 +198,7 @@ public function getValid(): array
198198
];
199199
}
200200

201-
public function getWithInvalidNetmask(): array
201+
public static function getWithInvalidNetmask(): array
202202
{
203203
return [
204204
['192.168.1.0/-1'],
@@ -217,7 +217,7 @@ public function getWithInvalidNetmask(): array
217217
];
218218
}
219219

220-
public function getWithInvalidMasksAndIps(): array
220+
public static function getWithInvalidMasksAndIps(): array
221221
{
222222
return [
223223
['0.0.0.0/foobar'],
@@ -236,15 +236,15 @@ public function getWithInvalidMasksAndIps(): array
236236
];
237237
}
238238

239-
public function getOutOfRangeNetmask(): array
239+
public static function getOutOfRangeNetmask(): array
240240
{
241241
return [
242242
['10.0.0.0/24', Ip::V4, 10, 20],
243243
['2001:0DB8:85A3:0000:0000:8A2E:0370:7334/24', Ip::V6, 10, 20],
244244
];
245245
}
246246

247-
public function getWithWrongVersion(): array
247+
public static function getWithWrongVersion(): array
248248
{
249249
return [
250250
['2001:0db8:85a3:0000:0000:8a2e:0370:7334/12', Ip::V4],

Tests/Constraints/CountryValidatorTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testValidCountries($country)
7070
$this->assertNoViolation();
7171
}
7272

73-
public function getValidCountries()
73+
public static function getValidCountries()
7474
{
7575
return [
7676
['GB'],
@@ -96,7 +96,7 @@ public function testInvalidCountries($country)
9696
->assertRaised();
9797
}
9898

99-
public function getInvalidCountries()
99+
public static function getInvalidCountries()
100100
{
101101
return [
102102
['foobar'],
@@ -116,7 +116,7 @@ public function testValidAlpha3Countries($country)
116116
$this->assertNoViolation();
117117
}
118118

119-
public function getValidAlpha3Countries()
119+
public static function getValidAlpha3Countries()
120120
{
121121
return [
122122
['GBR'],
@@ -143,7 +143,7 @@ public function testInvalidAlpha3Countries($country)
143143
->assertRaised();
144144
}
145145

146-
public function getInvalidAlpha3Countries()
146+
public static function getInvalidAlpha3Countries()
147147
{
148148
return [
149149
['foobar'],

0 commit comments

Comments
 (0)