Skip to content

Commit c91239c

Browse files
Merge branch '6.2' into 6.3
* 6.2: [Tests] Migrate tests to static data providers [Cache] Only validate dbindex parameter when applicable
2 parents da57429 + e5b42fc commit c91239c

8 files changed

+80
-77
lines changed

Tests/Constraints/CountValidatorArrayTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class CountValidatorArrayTest extends CountValidatorTestCase
1818
{
19-
protected function createCollection(array $content)
19+
protected static function createCollection(array $content)
2020
{
2121
return $content;
2222
}

Tests/Constraints/CountValidatorCountableTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class CountValidatorCountableTest extends CountValidatorTestCase
2020
{
21-
protected function createCollection(array $content)
21+
protected static function createCollection(array $content)
2222
{
2323
return new Countable($content);
2424
}

Tests/Constraints/CountValidatorTestCase.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ protected function createValidator(): CountValidator
2727
return new CountValidator();
2828
}
2929

30-
abstract protected function createCollection(array $content);
30+
abstract protected static function createCollection(array $content);
3131

3232
public function testNullIsValid()
3333
{
@@ -42,30 +42,30 @@ public function testExpectsCountableType()
4242
$this->validator->validate(new \stdClass(), new Count(5));
4343
}
4444

45-
public function getThreeOrLessElements()
45+
public static function getThreeOrLessElements()
4646
{
4747
return [
48-
[$this->createCollection([1])],
49-
[$this->createCollection([1, 2])],
50-
[$this->createCollection([1, 2, 3])],
51-
[$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3])],
48+
[static::createCollection([1])],
49+
[static::createCollection([1, 2])],
50+
[static::createCollection([1, 2, 3])],
51+
[static::createCollection(['a' => 1, 'b' => 2, 'c' => 3])],
5252
];
5353
}
5454

55-
public function getFourElements()
55+
public static function getFourElements()
5656
{
5757
return [
58-
[$this->createCollection([1, 2, 3, 4])],
59-
[$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4])],
58+
[static::createCollection([1, 2, 3, 4])],
59+
[static::createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4])],
6060
];
6161
}
6262

63-
public function getFiveOrMoreElements()
63+
public static function getFiveOrMoreElements()
6464
{
6565
return [
66-
[$this->createCollection([1, 2, 3, 4, 5])],
67-
[$this->createCollection([1, 2, 3, 4, 5, 6])],
68-
[$this->createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5])],
66+
[static::createCollection([1, 2, 3, 4, 5])],
67+
[static::createCollection([1, 2, 3, 4, 5, 6])],
68+
[static::createCollection(['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5])],
6969
];
7070
}
7171

Tests/Constraints/IpValidatorTest.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function testValidIpsV4($ip)
6464
$this->assertNoViolation();
6565
}
6666

67-
public function getValidIpsV4()
67+
public static function getValidIpsV4()
6868
{
6969
return [
7070
['0.0.0.0'],
@@ -101,7 +101,7 @@ public function testValidIpV6WithWhitespacesNamed()
101101
$this->assertNoViolation();
102102
}
103103

104-
public function getValidIpsV4WithWhitespaces()
104+
public static function getValidIpsV4WithWhitespaces()
105105
{
106106
return [
107107
["\x200.0.0.0"],
@@ -125,7 +125,7 @@ public function testValidIpsV6($ip)
125125
$this->assertNoViolation();
126126
}
127127

128-
public function getValidIpsV6()
128+
public static function getValidIpsV6()
129129
{
130130
return [
131131
['2001:0db8:85a3:0000:0000:8a2e:0370:7334'],
@@ -162,9 +162,9 @@ public function testValidIpsAll($ip)
162162
$this->assertNoViolation();
163163
}
164164

165-
public function getValidIpsAll()
165+
public static function getValidIpsAll()
166166
{
167-
return array_merge($this->getValidIpsV4(), $this->getValidIpsV6());
167+
return array_merge(self::getValidIpsV4(), self::getValidIpsV6());
168168
}
169169

170170
/**
@@ -185,7 +185,7 @@ public function testInvalidIpsV4($ip)
185185
->assertRaised();
186186
}
187187

188-
public function getInvalidIpsV4()
188+
public static function getInvalidIpsV4()
189189
{
190190
return [
191191
['0'],
@@ -218,7 +218,7 @@ public function testInvalidPrivateIpsV4($ip)
218218
->assertRaised();
219219
}
220220

221-
public function getInvalidPrivateIpsV4()
221+
public static function getInvalidPrivateIpsV4()
222222
{
223223
return [
224224
['10.0.0.0'],
@@ -245,7 +245,7 @@ public function testInvalidReservedIpsV4($ip)
245245
->assertRaised();
246246
}
247247

248-
public function getInvalidReservedIpsV4()
248+
public static function getInvalidReservedIpsV4()
249249
{
250250
return [
251251
['0.0.0.0'],
@@ -272,9 +272,9 @@ public function testInvalidPublicIpsV4($ip)
272272
->assertRaised();
273273
}
274274

275-
public function getInvalidPublicIpsV4()
275+
public static function getInvalidPublicIpsV4()
276276
{
277-
return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidReservedIpsV4());
277+
return array_merge(self::getInvalidPrivateIpsV4(), self::getInvalidReservedIpsV4());
278278
}
279279

280280
/**
@@ -295,7 +295,7 @@ public function testInvalidIpsV6($ip)
295295
->assertRaised();
296296
}
297297

298-
public function getInvalidIpsV6()
298+
public static function getInvalidIpsV6()
299299
{
300300
return [
301301
['z001:0db8:85a3:0000:0000:8a2e:0370:7334'],
@@ -332,7 +332,7 @@ public function testInvalidPrivateIpsV6($ip)
332332
->assertRaised();
333333
}
334334

335-
public function getInvalidPrivateIpsV6()
335+
public static function getInvalidPrivateIpsV6()
336336
{
337337
return [
338338
['fdfe:dcba:9876:ffff:fdc6:c46b:bb8f:7d4c'],
@@ -359,12 +359,12 @@ public function testInvalidReservedIpsV6($ip)
359359
->assertRaised();
360360
}
361361

362-
public function getInvalidReservedIpsV6()
362+
public static function getInvalidReservedIpsV6()
363363
{
364364
// Quoting after official filter documentation:
365365
// "FILTER_FLAG_NO_RES_RANGE = This flag does not apply to IPv6 addresses."
366366
// Full description: https://php.net/filter.filters.flags
367-
return $this->getInvalidIpsV6();
367+
return self::getInvalidIpsV6();
368368
}
369369

370370
/**
@@ -385,9 +385,9 @@ public function testInvalidPublicIpsV6($ip)
385385
->assertRaised();
386386
}
387387

388-
public function getInvalidPublicIpsV6()
388+
public static function getInvalidPublicIpsV6()
389389
{
390-
return array_merge($this->getInvalidPrivateIpsV6(), $this->getInvalidReservedIpsV6());
390+
return array_merge(self::getInvalidPrivateIpsV6(), self::getInvalidReservedIpsV6());
391391
}
392392

393393
/**
@@ -408,9 +408,9 @@ public function testInvalidIpsAll($ip)
408408
->assertRaised();
409409
}
410410

411-
public function getInvalidIpsAll()
411+
public static function getInvalidIpsAll()
412412
{
413-
return array_merge($this->getInvalidIpsV4(), $this->getInvalidIpsV6());
413+
return array_merge(self::getInvalidIpsV4(), self::getInvalidIpsV6());
414414
}
415415

416416
/**
@@ -431,9 +431,9 @@ public function testInvalidPrivateIpsAll($ip)
431431
->assertRaised();
432432
}
433433

434-
public function getInvalidPrivateIpsAll()
434+
public static function getInvalidPrivateIpsAll()
435435
{
436-
return array_merge($this->getInvalidPrivateIpsV4(), $this->getInvalidPrivateIpsV6());
436+
return array_merge(self::getInvalidPrivateIpsV4(), self::getInvalidPrivateIpsV6());
437437
}
438438

439439
/**
@@ -454,9 +454,9 @@ public function testInvalidReservedIpsAll($ip)
454454
->assertRaised();
455455
}
456456

457-
public function getInvalidReservedIpsAll()
457+
public static function getInvalidReservedIpsAll()
458458
{
459-
return array_merge($this->getInvalidReservedIpsV4(), $this->getInvalidReservedIpsV6());
459+
return array_merge(self::getInvalidReservedIpsV4(), self::getInvalidReservedIpsV6());
460460
}
461461

462462
/**
@@ -477,8 +477,8 @@ public function testInvalidPublicIpsAll($ip)
477477
->assertRaised();
478478
}
479479

480-
public function getInvalidPublicIpsAll()
480+
public static function getInvalidPublicIpsAll()
481481
{
482-
return array_merge($this->getInvalidPublicIpsV4(), $this->getInvalidPublicIpsV6());
482+
return array_merge(self::getInvalidPublicIpsV4(), self::getInvalidPublicIpsV6());
483483
}
484484
}

Tests/Constraints/IsbnValidatorTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function createValidator(): IsbnValidator
2626
return new IsbnValidator();
2727
}
2828

29-
public function getValidIsbn10()
29+
public static function getValidIsbn10()
3030
{
3131
return [
3232
['2723442284'],
@@ -45,7 +45,7 @@ public function getValidIsbn10()
4545
];
4646
}
4747

48-
public function getInvalidIsbn10()
48+
public static function getInvalidIsbn10()
4949
{
5050
return [
5151
['27234422841', Isbn::TOO_LONG_ERROR],
@@ -65,7 +65,7 @@ public function getInvalidIsbn10()
6565
];
6666
}
6767

68-
public function getValidIsbn13()
68+
public static function getValidIsbn13()
6969
{
7070
return [
7171
['978-2723442282'],
@@ -83,7 +83,7 @@ public function getValidIsbn13()
8383
];
8484
}
8585

86-
public function getInvalidIsbn13()
86+
public static function getInvalidIsbn13()
8787
{
8888
return [
8989
['978-27234422821', Isbn::TOO_LONG_ERROR],
@@ -103,19 +103,19 @@ public function getInvalidIsbn13()
103103
];
104104
}
105105

106-
public function getValidIsbn()
106+
public static function getValidIsbn()
107107
{
108108
return array_merge(
109-
$this->getValidIsbn10(),
110-
$this->getValidIsbn13()
109+
self::getValidIsbn10(),
110+
self::getValidIsbn13()
111111
);
112112
}
113113

114-
public function getInvalidIsbn()
114+
public static function getInvalidIsbn()
115115
{
116116
return array_merge(
117-
$this->getInvalidIsbn10(),
118-
$this->getInvalidIsbn13()
117+
self::getInvalidIsbn10(),
118+
self::getInvalidIsbn13()
119119
);
120120
}
121121

Tests/Constraints/IssnValidatorTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function createValidator(): IssnValidator
2626
return new IssnValidator();
2727
}
2828

29-
public function getValidLowerCasedIssn()
29+
public static function getValidLowerCasedIssn()
3030
{
3131
return [
3232
['2162-321x'],
@@ -39,7 +39,7 @@ public function getValidLowerCasedIssn()
3939
];
4040
}
4141

42-
public function getValidNonHyphenatedIssn()
42+
public static function getValidNonHyphenatedIssn()
4343
{
4444
return [
4545
['2162321X'],
@@ -52,7 +52,7 @@ public function getValidNonHyphenatedIssn()
5252
];
5353
}
5454

55-
public function getFullValidIssn()
55+
public static function getFullValidIssn()
5656
{
5757
return [
5858
['1550-7416'],
@@ -66,16 +66,16 @@ public function getFullValidIssn()
6666
];
6767
}
6868

69-
public function getValidIssn()
69+
public static function getValidIssn()
7070
{
7171
return array_merge(
72-
$this->getValidLowerCasedIssn(),
73-
$this->getValidNonHyphenatedIssn(),
74-
$this->getFullValidIssn()
72+
self::getValidLowerCasedIssn(),
73+
self::getValidNonHyphenatedIssn(),
74+
self::getFullValidIssn()
7575
);
7676
}
7777

78-
public function getInvalidIssn()
78+
public static function getInvalidIssn()
7979
{
8080
return [
8181
[0, Issn::TOO_SHORT_ERROR],

0 commit comments

Comments
 (0)