Skip to content

Commit c0944ec

Browse files
chore: phpunit 10 (#49)
* feat: allow phpunit 10, migrate phpunit-config files. * feat: allow phpunit 10, migrate phpunit-config files. --------- Co-authored-by: Christopher Georg <christopher.georg@sr-travel.de>
1 parent 0405c2b commit c0944ec

12 files changed

Lines changed: 42 additions & 34 deletions

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ jobs:
5151
composer update --no-interaction --prefer-dist --optimize-autoloader
5252
5353
- name: Execute tests
54-
run: vendor/bin/phpunit -c ./phpunit.xml.dist ./tests --verbose
54+
run: vendor/bin/phpunit -c ./phpunit.xml.dist ./tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ composer.lock
1717
vendor/
1818

1919
.phpunit.result.cache
20+
.phpunit.cache
2021
code-coverage

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"symfony/validator": ">=4.4.40"
1616
},
1717
"require-dev": {
18-
"phpunit/phpunit": "^9.5"
18+
"phpunit/phpunit": "^9.6 || ^10.1"
1919
},
2020
"autoload": {
2121
"psr-4": {

phpunit.xml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- https://phpunit.readthedocs.io/en/9.6/configuration.html -->
2+
<!-- https://docs.phpunit.de/en/10.1/configuration.html -->
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
bootstrap="vendor/autoload.php"
5-
colors="true"
6-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">
7-
<coverage processUncoveredFiles="true">
8-
<include>
9-
<directory suffix=".php">./tests</directory>
10-
</include>
11-
</coverage>
4+
bootstrap="vendor/autoload.php" colors="true"
5+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
6+
cacheDirectory=".phpunit.cache">
7+
<coverage/>
8+
129
<testsuites>
1310
<testsuite name="unit">
1411
<directory suffix=".php">./tests</directory>
1512
</testsuite>
1613
</testsuites>
14+
15+
<source>
16+
<include>
17+
<directory suffix=".php">./src/</directory>
18+
</include>
19+
<exclude>
20+
<directory>./tests</directory>
21+
</exclude>
22+
</source>
1723
</phpunit>

phpunit.xml.dist

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<!-- https://phpunit.readthedocs.io/en/9.6/configuration.html -->
2+
<!-- https://docs.phpunit.de/en/10.1/configuration.html -->
33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="vendor/autoload.php" colors="true"
45
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
colors="true"
6-
bootstrap="vendor/autoload.php">
7-
8-
<coverage processUncoveredFiles="true">
9-
<include>
10-
<directory suffix=".php">./src/</directory>
11-
</include>
12-
<exclude>
13-
<directory>./tests</directory>
14-
</exclude>
6+
cacheDirectory=".phpunit.cache">
7+
<coverage>
158
<report>
169
<html outputDirectory="code-coverage" lowUpperBound="35" highLowerBound="70"/>
1710
</report>
@@ -29,4 +22,12 @@
2922

3023
<logging/>
3124

25+
<source>
26+
<include>
27+
<directory suffix=".php">./src/</directory>
28+
</include>
29+
<exclude>
30+
<directory>./tests</directory>
31+
</exclude>
32+
</source>
3233
</phpunit>

tests/Constraints/ChZipCodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testValidationOfChZipCode(string $zipCode): void
4040
$this->validator->validate($zipCode, $constraint);
4141
}
4242

43-
public function chValidZipCodes(): array
43+
public static function chValidZipCodes(): array
4444
{
4545
return [
4646
['1000'],
@@ -76,7 +76,7 @@ public function testValidationErrorWithInvalidChZipCode(string $zipcode): void
7676
$this->validator->validate($zipcode, $constraint);
7777
}
7878

79-
public function chInvalidZipCodes(): array
79+
public static function chInvalidZipCodes(): array
8080
{
8181
return [
8282
['0000'],

tests/Constraints/EsZipCodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function testValidationOfEsZipCode(string $zipCode): void
4040
$this->validator->validate($zipCode, $constraint);
4141
}
4242

43-
public function esValidZipCodes(): array
43+
public static function esValidZipCodes(): array
4444
{
4545
return [
4646
['08020'],
@@ -76,7 +76,7 @@ public function testValidationErrorWithInvalidEsZipCode(string $zipcode): void
7676
$this->validator->validate($zipcode, $constraint);
7777
}
7878

79-
public function esInvalidZipCodes(): array
79+
public static function esInvalidZipCodes(): array
8080
{
8181
return [
8282
['53456'],

tests/Constraints/GbZipCodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testValidationOfGbZipCodeWithIso($zipCode): void
4444
/**
4545
* @dataProvider
4646
*/
47-
public function gbZipCodes(): array
47+
public static function gbZipCodes(): array
4848
{
4949
return [
5050
['EC1A 1BB'],
@@ -88,7 +88,7 @@ public function testValidationOfGbZipCodeWithIsoAndSmallCaps(string $zipCode): v
8888
/**
8989
* @dataProvider
9090
*/
91-
public function gbZipCodesSmallCaps(): array
91+
public static function gbZipCodesSmallCaps(): array
9292
{
9393
return [
9494
['ec1a 1bb'],

tests/Constraints/JmZipCodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testValidZipcodes(string $zipCode): void
4747
* used postal codes
4848
* from https://en.wikipedia.org/wiki/Postal_codes_in_Jamaica
4949
*/
50-
public function getValidJamaicaZipCodes(): array
50+
public static function getValidJamaicaZipCodes(): array
5151
{
5252
return [
5353
['KN'],
@@ -88,7 +88,7 @@ public function testInvalidZipcodes(string $zipCode): void
8888
* used postal codes
8989
* from https://en.wikipedia.org/wiki/Postal_codes_in_Jamaica
9090
*/
91-
public function getInvalidJamaicaZipCodes(): array
91+
public static function getInvalidJamaicaZipCodes(): array
9292
{
9393
return [
9494
['12'],

tests/Constraints/LtZipCodeValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function testValidZipcodes(string $zipCode): void
4242
* Valid Lithuanian postal codes are five-digit numbers, optionally prefixed with "LT-".
4343
* @see https://en.wikipedia.org/wiki/Postal_codes_in_Lithuania
4444
*/
45-
public function getValidLithuanianZipCodes(): array
45+
public static function getValidLithuanianZipCodes(): array
4646
{
4747
return [
4848
['12345'],
@@ -81,7 +81,7 @@ public function testInvalidZipcodes(string $zipCode): void
8181
* Valid Lithuanian postal codes are five-digit numbers, optionally prefixed with "LT-".
8282
* @see https://en.wikipedia.org/wiki/Postal_codes_in_Lithuania
8383
*/
84-
public function getInvalidLithuanianZipCodes(): array
84+
public static function getInvalidLithuanianZipCodes(): array
8585
{
8686
return [
8787
['1234'],

0 commit comments

Comments
 (0)