Skip to content

Commit 6c6a113

Browse files
authored
Merge pull request #350 from ker0x/bugfix/tests
Fix tests
2 parents 06c094c + f479f36 commit 6c6a113

19 files changed

+911
-169
lines changed

.github/workflows/ci.yml

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
11
name: CI
2-
on: [push, pull_request]
2+
on: [ push, pull_request ]
33

44
concurrency:
5-
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
6-
cancel-in-progress: true
5+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
6+
cancel-in-progress: true
77

88
jobs:
9-
phpstan:
10-
name: PHPStan
11-
runs-on: ubuntu-latest
12-
env:
13-
php-version: 8.2
14-
steps:
15-
- name: "Setup PHP"
16-
uses: shivammathur/setup-php@v2
17-
with:
18-
php-version: ${{ env.php-version }}
19-
tools: flex
9+
phpstan:
10+
name: PHPStan
11+
runs-on: ubuntu-latest
12+
env:
13+
php-version: 8.2
14+
steps:
15+
- name: "Setup PHP"
16+
uses: shivammathur/setup-php@v2
17+
with:
18+
php-version: ${{ env.php-version }}
19+
tools: flex
2020

21-
- name: "Checkout code"
22-
uses: actions/checkout@v4
21+
- name: "Checkout code"
22+
uses: actions/checkout@v4
2323

24-
- name: "Install Composer dependencies"
25-
uses: "ramsey/composer-install@v2"
26-
with:
27-
composer-options: "--optimize-autoloader"
24+
- name: "Install Composer dependencies"
25+
uses: "ramsey/composer-install@v2"
26+
with:
27+
composer-options: "--optimize-autoloader"
2828

29-
- name: "Run PHPStan"
30-
run: |
31-
vendor/bin/simple-phpunit --version
32-
vendor/bin/phpstan analyse --no-progress
29+
- name: "Run PHPStan"
30+
run: |
31+
vendor/bin/simple-phpunit --version
32+
vendor/bin/phpstan analyse --no-progress
3333
34-
php-cs-fixer:
35-
name: PHP-CS-Fixer
36-
runs-on: ubuntu-latest
37-
env:
38-
php-version: 8.2
39-
steps:
40-
- name: "Setup PHP"
41-
uses: shivammathur/setup-php@v2
42-
with:
43-
php-version: ${{ env.php-version }}
44-
tools: flex, cs2pr
34+
php-cs-fixer:
35+
name: PHP-CS-Fixer
36+
runs-on: ubuntu-latest
37+
env:
38+
php-version: 8.2
39+
steps:
40+
- name: "Setup PHP"
41+
uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ env.php-version }}
44+
tools: flex, cs2pr
4545

46-
- name: "Checkout code"
47-
uses: actions/checkout@v4
46+
- name: "Checkout code"
47+
uses: actions/checkout@v4
4848

49-
- name: "Install Composer dependencies"
50-
uses: "ramsey/composer-install@v2"
51-
with:
52-
composer-options: "--optimize-autoloader"
49+
- name: "Install Composer dependencies"
50+
uses: "ramsey/composer-install@v2"
51+
with:
52+
composer-options: "--optimize-autoloader"
5353

54-
- name: "Run PHP-CS-Fixer"
55-
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr
54+
- name: "Run PHP-CS-Fixer"
55+
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr
5656

57-
phpunit:
58-
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }})
59-
runs-on: ubuntu-latest
60-
strategy:
61-
max-parallel: 10
62-
fail-fast: true
63-
matrix:
64-
dependencies: ['highest']
65-
php: ['7.4', '8.0', '8.1', '8.2']
66-
include:
67-
- php: '7.4'
68-
sf_version: '4.4.*'
69-
dependencies: 'lowest'
70-
- php: '7.4'
71-
sf_version: '4.4.*'
72-
- php: '7.4'
73-
sf_version: '5.4.*'
74-
dependencies: 'lowest'
75-
- php: '8.0'
76-
sf_version: '5.4.*'
77-
- php: '8.1'
78-
sf_version: '5.4.*'
79-
- php: '8.0'
80-
sf_version: '6.0.*'
81-
- php: '8.1'
82-
sf_version: '6.0.*'
83-
- php: '8.2'
84-
sf_version: '6.2.*'
85-
- php: '8.2'
86-
sf_version: '6.4.*'
87-
- php: '8.2'
88-
sf_version: '7.0.*'
89-
steps:
90-
- name: "Setup PHP"
91-
uses: shivammathur/setup-php@v2
92-
with:
93-
php-version: ${{ matrix.php }}
94-
tools: flex
95-
coverage: none
57+
phpunit:
58+
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }})
59+
runs-on: ubuntu-latest
60+
strategy:
61+
max-parallel: 10
62+
fail-fast: false
63+
matrix:
64+
dependencies: ['highest']
65+
php: [ '7.4', '8.0', '8.1', '8.2' ]
66+
sf_version: [ '4.4.*', '5.4.*', '6.4.*', '7.0.*' ]
67+
include:
68+
- php: '7.4'
69+
sf_version: '4.4.*'
70+
dependencies: 'lowest'
71+
- php: '7.4'
72+
sf_version: '5.4.*'
73+
dependencies: 'lowest'
74+
exclude:
75+
- php: '7.4'
76+
sf_version: '4.4.*'
77+
- php: '7.4'
78+
sf_version: '6.4.*'
79+
- php: '8.0'
80+
sf_version: '6.4.*'
81+
- php: '7.4'
82+
sf_version: '7.0.*'
83+
- php: '8.0'
84+
sf_version: '7.0.*'
85+
- php: '8.1'
86+
sf_version: '7.0.*'
87+
steps:
88+
- name: "Checkout code"
89+
uses: actions/checkout@v4
9690

97-
- name: "Checkout code"
98-
uses: actions/checkout@v4
91+
- name: "Setup PHP"
92+
uses: shivammathur/setup-php@v2
93+
with:
94+
php-version: ${{ matrix.php }}
95+
tools: flex
96+
coverage: none
9997

100-
- name: "Install Composer dependencies"
101-
uses: "ramsey/composer-install@v2"
102-
with:
103-
composer-options: "--optimize-autoloader"
104-
dependency-versions: "${{ matrix.dependencies }}"
98+
- name: "Install Composer dependencies"
99+
env:
100+
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
101+
uses: "ramsey/composer-install@v2"
102+
with:
103+
composer-options: "--optimize-autoloader"
104+
dependency-versions: "${{ matrix.dependencies }}"
105105

106-
- name: "Run tests"
107-
env:
108-
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=3&max[indirect]=1'
109-
run: ./vendor/bin/simple-phpunit -v
106+
- name: "Run tests"
107+
env:
108+
SYMFONY_DEPRECATIONS_HELPER: 'baselineFile=./tests/allowed.json'
109+
run: ./vendor/bin/simple-phpunit -v

composer.json

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"name": "willdurand/geocoder-bundle",
33
"description": "Integration of Geocoder into Symfony",
4-
"keywords": ["geocoding", "geocoder"],
4+
"keywords": [
5+
"geocoding",
6+
"geocoder"
7+
],
58
"type": "symfony-bundle",
69
"license": "MIT",
710
"authors": [
@@ -15,17 +18,17 @@
1518
"geocoder-php/plugin": "^1.5",
1619
"php-http/curl-client": "^2.3",
1720
"php-http/discovery": "^1.14",
18-
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
19-
"symfony/framework-bundle": "^4.4 || ^5.0 || ^6.0 || ^7.0",
20-
"symfony/options-resolver": "^4.4 || ^5.0 || ^6.0 || ^7.0",
21+
"symfony/console": "^4.4 || ^5.4 || ^6.4 || ^7.0",
22+
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.4 || ^7.0",
23+
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.4 || ^7.0",
2124
"willdurand/geocoder": "^4.6"
2225
},
2326
"require-dev": {
2427
"doctrine/annotations": "^1.11.1 || ^2.0",
2528
"doctrine/doctrine-bundle": "^2.3",
26-
"doctrine/orm": "~2.8",
29+
"doctrine/orm": "^2.8",
2730
"fakerphp/faker": "^1.20",
28-
"friendsofphp/php-cs-fixer": "^3.13",
31+
"friendsofphp/php-cs-fixer": "^3.0",
2932
"geocoder-php/algolia-places-provider": "^0.4",
3033
"geocoder-php/arcgis-online-provider": "^4.4",
3134
"geocoder-php/bing-maps-provider": "^4.3",
@@ -58,15 +61,17 @@
5861
"geoip/geoip": "~1.17",
5962
"nyholm/nsa": "^1.3",
6063
"nyholm/psr7": "^1.5",
61-
"nyholm/symfony-bundle-test": "dev-master",
62-
"php-http/mock-client": "^1.6",
64+
"nyholm/symfony-bundle-test": "^2.0 || ^3.0",
6365
"php-http/message": "^1.13",
66+
"php-http/mock-client": "^1.6",
6467
"phpstan/phpstan": "^1.9.2",
6568
"psr/http-client": "^1.0",
69+
"psr/simple-cache": "^1.0 || ^2.0",
6670
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",
6771
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
6872
"symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0",
6973
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
74+
"symfony/var-exporter": "^5.0 || ^6.0 || ^7.0",
7075
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
7176
},
7277
"conflict": {

phpstan-baseline.neon

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ parameters:
121121
path: src/DependencyInjection/BazingaGeocoderExtension.php
122122

123123
-
124-
message: "#^Cannot call method end\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#"
124+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:end\\(\\)\\.$#"
125125
count: 2
126126
path: src/DependencyInjection/Configuration.php
127127

128128
-
129-
message: "#^Cannot call method variableNode\\(\\) on Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\|null\\.$#"
129+
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeParentInterface\\:\\:variableNode\\(\\)\\.$#"
130130
count: 1
131131
path: src/DependencyInjection/Configuration.php
132132

@@ -140,11 +140,6 @@ parameters:
140140
count: 1
141141
path: src/Doctrine/ORM/GeocoderListener.php
142142

143-
-
144-
message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\FakeIpPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#"
145-
count: 1
146-
path: src/Plugin/FakeIpPlugin.php
147-
148143
-
149144
message: "#^Parameter \\#1 \\$text of method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:withText\\(\\) expects string, string\\|null given\\.$#"
150145
count: 1
@@ -155,11 +150,6 @@ parameters:
155150
count: 1
156151
path: src/Plugin/FakeIpPlugin.php
157152

158-
-
159-
message: "#^Method Bazinga\\\\GeocoderBundle\\\\Plugin\\\\ProfilingPlugin\\:\\:handleQuery\\(\\) return type with generic interface Http\\\\Promise\\\\Promise does not specify its types\\: T$#"
160-
count: 1
161-
path: src/Plugin/ProfilingPlugin.php
162-
163153
-
164154
message: "#^Parameter \\#1 \\$accountId of class GeoIp2\\\\WebService\\\\Client constructor expects int, int\\|null given\\.$#"
165155
count: 1

phpunit.xml.dist

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
bootstrap="tests/bootstrap.php"
3+
<phpunit
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
colors="true"
8+
convertErrorsToExceptions="true"
9+
convertNoticesToExceptions="true"
10+
convertWarningsToExceptions="true"
11+
processIsolation="false"
12+
stopOnFailure="false"
13+
bootstrap="tests/bootstrap.php"
14+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
1215
>
16+
<coverage>
17+
<include>
18+
<directory>src</directory>
19+
</include>
20+
</coverage>
21+
1322
<testsuites>
1423
<testsuite name="main">
1524
<directory>./tests</directory>
1625
</testsuite>
1726
</testsuites>
1827

19-
<filter>
20-
<whitelist>
21-
<directory>src</directory>
22-
</whitelist>
23-
</filter>
24-
2528
<listeners>
26-
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
29+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
2730
</listeners>
2831
</phpunit>

src/Validator/Constraint/Address.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
/**
1818
* @Annotation
19-
*
2019
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
2120
*
2221
* @author Tomas Norkūnas <[email protected]>

tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function tearDown(): void
3434
$reflection = new \ReflectionObject($this->compilerPass);
3535
$prop = $reflection->getProperty('factoryServiceIds');
3636
$prop->setAccessible(true);
37-
$prop->setValue([]);
37+
$prop->setValue(null, []);
3838
}
3939

4040
public function testProcessThrows(): void

0 commit comments

Comments
 (0)