Skip to content

Commit 8c4725c

Browse files
committed
Fix tests
1 parent 06c094c commit 8c4725c

19 files changed

+263
-73
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
matrix:
6464
dependencies: ['highest']
6565
php: ['7.4', '8.0', '8.1', '8.2']
66+
sf_version: ['4.4.*', '5.4.*', '6.4.*', '7.0.*']
6667
include:
6768
- php: '7.4'
6869
sf_version: '4.4.*'
@@ -76,12 +77,8 @@ jobs:
7677
sf_version: '5.4.*'
7778
- php: '8.1'
7879
sf_version: '5.4.*'
79-
- php: '8.0'
80-
sf_version: '6.0.*'
8180
- php: '8.1'
82-
sf_version: '6.0.*'
83-
- php: '8.2'
84-
sf_version: '6.2.*'
81+
sf_version: '6.4.*'
8582
- php: '8.2'
8683
sf_version: '6.4.*'
8784
- php: '8.2'
@@ -95,7 +92,10 @@ jobs:
9592
coverage: none
9693

9794
- name: "Checkout code"
98-
uses: actions/checkout@v4
95+
uses: actions/checkout@
96+
97+
- name: "Configure Symfony"
98+
run: composer config extra.symfony.require "${{ matrix.sf_version }}"
9999

100100
- name: "Install Composer dependencies"
101101
uses: "ramsey/composer-install@v2"
@@ -105,5 +105,5 @@ jobs:
105105

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

composer.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"geocoder-php/plugin": "^1.5",
1616
"php-http/curl-client": "^2.3",
1717
"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",
18+
"symfony/console": "^4.4 || ^5.4 || ^6.4 || ^7.0",
19+
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.4 || ^7.0",
20+
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.4 || ^7.0",
2121
"willdurand/geocoder": "^4.6"
2222
},
2323
"require-dev": {
@@ -59,15 +59,16 @@
5959
"nyholm/nsa": "^1.3",
6060
"nyholm/psr7": "^1.5",
6161
"nyholm/symfony-bundle-test": "dev-master",
62-
"php-http/mock-client": "^1.6",
6362
"php-http/message": "^1.13",
63+
"php-http/mock-client": "^1.6",
6464
"phpstan/phpstan": "^1.9.2",
6565
"psr/http-client": "^1.0",
66-
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",
67-
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
68-
"symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0",
69-
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
70-
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
66+
"symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0",
67+
"symfony/config": "^4.4 || ^5.4 || ^6.4 || ^7.0",
68+
"symfony/phpunit-bridge": "^5.2 || ^6.4 || ^7.0",
69+
"symfony/validator": "^4.4 || ^5.4 || ^6.4 || ^7.0",
70+
"symfony/var-exporter": "^5.4 || ^6.4 || ^7.0",
71+
"symfony/yaml": "^4.4 || ^5.4 || ^6.4 || ^7.0"
7172
},
7273
"conflict": {
7374
"geocoder-php/nominatim-provider": "<5.0"

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 <norkunas.tom@gmail.com>

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

tests/Functional/BundleInitializationTest.php

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public function testInitBundle(): void
5555
{
5656
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
5757
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
58+
59+
if ($kernel::VERSION_ID >= 50000) {
60+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
61+
}
62+
63+
if ($kernel::VERSION_ID >= 60000) {
64+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
65+
}
5866
}]);
5967

6068
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -70,6 +78,14 @@ public function testBundleWithOneProviderConfiguration(): void
7078
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
7179
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
7280
$kernel->addTestConfig(__DIR__.'/config/simple.yml');
81+
82+
if ($kernel::VERSION_ID >= 50000) {
83+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
84+
}
85+
86+
if ($kernel::VERSION_ID >= 60000) {
87+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
88+
}
7389
}]);
7490

7591
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -85,6 +101,14 @@ public function testBundleWithCachedProvider(): void
85101
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
86102
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
87103
$kernel->addTestConfig(__DIR__.'/config/cache.yml');
104+
105+
if ($kernel::VERSION_ID >= 50000) {
106+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
107+
}
108+
109+
if ($kernel::VERSION_ID >= 60000) {
110+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
111+
}
88112
}]);
89113

90114
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -102,6 +126,14 @@ public function testCacheLifetimeCanBeNull(): void
102126
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
103127
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
104128
$kernel->addTestConfig(__DIR__.'/config/cache_without_lifetime.yml');
129+
130+
if ($kernel::VERSION_ID >= 50000) {
131+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
132+
}
133+
134+
if ($kernel::VERSION_ID >= 60000) {
135+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
136+
}
105137
}]);
106138

107139
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -127,6 +159,14 @@ public function testBundleWithPluginsYml(): void
127159
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
128160
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
129161
$kernel->addTestConfig(__DIR__.'/config/service_plugin.yml');
162+
163+
if ($kernel::VERSION_ID >= 50000) {
164+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
165+
}
166+
167+
if ($kernel::VERSION_ID >= 60000) {
168+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
169+
}
130170
}]);
131171

132172
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -144,6 +184,14 @@ public function testBundleWithPluginXml(): void
144184
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
145185
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
146186
$kernel->addTestConfig(__DIR__.'/config/service_plugin.xml');
187+
188+
if ($kernel::VERSION_ID >= 50000) {
189+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
190+
}
191+
192+
if ($kernel::VERSION_ID >= 60000) {
193+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
194+
}
147195
}]);
148196

149197
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
@@ -160,6 +208,14 @@ public function testBundleHasRegisteredDumpers(): void
160208
{
161209
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
162210
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
211+
212+
if ($kernel::VERSION_ID >= 50000) {
213+
$kernel->addTestConfig(__DIR__.'/config/framework_sf5.yml');
214+
}
215+
216+
if ($kernel::VERSION_ID >= 60000) {
217+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
218+
}
163219
}]);
164220

165221
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();

0 commit comments

Comments
 (0)