Skip to content

Commit 5ef8c19

Browse files
committedJan 17, 2025·
Drop support for Symfony < 5.4, drop CI test for Symfony 7.1
1 parent c43f2b0 commit 5ef8c19

12 files changed

+123
-217
lines changed
 

‎.github/workflows/ci.yml

+4-16
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
name: PHP-CS-Fixer
3636
runs-on: ubuntu-latest
3737
env:
38-
php-version: 8.2
38+
php-version: 8.4
3939
PHP_CS_FIXER_IGNORE_ENV: 1
4040
steps:
4141
- name: "Setup PHP"
@@ -56,30 +56,19 @@ jobs:
5656
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no --format=checkstyle | cs2pr
5757

5858
phpunit:
59-
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }}) (${{ matrix.dependencies }})
59+
name: PHPUnit (PHP ${{ matrix.php }}) (Symfony ${{ matrix.sf_version }})
6060
runs-on: ubuntu-latest
6161
strategy:
6262
max-parallel: 10
6363
fail-fast: false
6464
matrix:
65-
dependencies: ['highest']
66-
php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
67-
sf_version: ['4.4.*', '5.4.*', '6.4.*', '7.1.*', '7.2.*']
65+
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]
66+
sf_version: [ '5.4.*', '6.4.*', '7.2.*' ]
6867
exclude:
69-
- php: '7.4'
70-
sf_version: '4.4.*'
71-
- php: '8.4'
72-
sf_version: '4.4.*'
7368
- php: '7.4'
7469
sf_version: '6.4.*'
7570
- php: '8.0'
7671
sf_version: '6.4.*'
77-
- php: '7.4'
78-
sf_version: '7.1.*'
79-
- php: '8.0'
80-
sf_version: '7.1.*'
81-
- php: '8.1'
82-
sf_version: '7.1.*'
8372
- php: '7.4'
8473
sf_version: '7.2.*'
8574
- php: '8.0'
@@ -104,7 +93,6 @@ jobs:
10493
uses: "ramsey/composer-install@v3"
10594
with:
10695
composer-options: "--optimize-autoloader"
107-
dependency-versions: "${{ matrix.dependencies }}"
10896

10997
- name: "Run tests"
11098
env:

‎composer.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
"geocoder-php/plugin": "^1.5",
1919
"php-http/curl-client": "^2.3",
2020
"php-http/discovery": "^1.14",
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",
21+
"symfony/console": "^5.4 || ^6.4 || ^7.0",
22+
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0",
23+
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",
2424
"willdurand/geocoder": "^4.6"
2525
},
2626
"require-dev": {
2727
"doctrine/annotations": "^1.11.1 || ^2.0",
2828
"doctrine/doctrine-bundle": "^2.3",
2929
"doctrine/orm": "^2.8 || ^3.0",
3030
"fakerphp/faker": "^1.20",
31-
"friendsofphp/php-cs-fixer": "^3.0",
31+
"friendsofphp/php-cs-fixer": "^3.13",
3232
"geocoder-php/algolia-places-provider": "^0.4",
3333
"geocoder-php/arcgis-online-provider": "^4.4",
3434
"geocoder-php/bing-maps-provider": "^4.3",
@@ -67,12 +67,12 @@
6767
"phpstan/phpstan": "^1.9.2",
6868
"psr/http-client": "^1.0",
6969
"psr/simple-cache": "^1.0 || ^2.0",
70-
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",
71-
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
72-
"symfony/phpunit-bridge": "^6.1",
73-
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
74-
"symfony/var-exporter": "^5.0 || ^6.0 || ^7.0",
75-
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
70+
"symfony/cache": "^5.4 || ^6.4 || ^7.0",
71+
"symfony/config": "^5.4 || ^6.4 || ^7.0",
72+
"symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0",
73+
"symfony/validator": "^5.4 || ^6.4 || ^7.0",
74+
"symfony/var-exporter": "^5.4 || ^6.4 || ^7.0",
75+
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
7676
},
7777
"conflict": {
7878
"geocoder-php/nominatim-provider": "<5.0"

‎tests/Functional/BundleInitializationTest.php

+38-36
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Bazinga\GeocoderBundle\Tests\Functional;
1414

1515
use Bazinga\GeocoderBundle\BazingaGeocoderBundle;
16-
use Bazinga\GeocoderBundle\Tests\PublicServicePass;
1716
use Geocoder\Dumper\GeoArray;
1817
use Geocoder\Dumper\GeoJson;
1918
use Geocoder\Dumper\Gpx;
@@ -44,24 +43,22 @@ protected static function createKernel(array $options = []): KernelInterface
4443
*/
4544
$kernel = parent::createKernel($options);
4645
$kernel->addTestBundle(BazingaGeocoderBundle::class);
47-
$kernel->addTestCompilerPass(new PublicServicePass('|[Bb]azinga:*|'));
48-
$kernel->addTestCompilerPass(new PublicServicePass('|[gG]eocoder:*|'));
4946
$kernel->handleOptions($options);
5047

5148
return $kernel;
5249
}
5350

5451
public function testInitBundle(): void
5552
{
56-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
53+
self::bootKernel(['config' => static function (TestKernel $kernel) {
5754
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
5855

59-
if ($kernel::VERSION_ID >= 50000) {
60-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
56+
if ($kernel::VERSION_ID >= 60000) {
57+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
6158
}
6259
}]);
6360

64-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
61+
$container = self::getContainer();
6562

6663
// Test if services exists
6764
self::assertTrue($container->has(ProviderAggregator::class));
@@ -71,16 +68,17 @@ public function testInitBundle(): void
7168

7269
public function testBundleWithOneProviderConfiguration(): void
7370
{
74-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
71+
self::bootKernel(['config' => static function (TestKernel $kernel) {
7572
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
76-
$kernel->addTestConfig(__DIR__.'/config/simple.yml');
7773

78-
if ($kernel::VERSION_ID >= 50000) {
79-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
74+
if ($kernel::VERSION_ID >= 60000) {
75+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
8076
}
77+
78+
$kernel->addTestConfig(__DIR__.'/config/simple.yml');
8179
}]);
8280

83-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
81+
$container = self::getContainer();
8482

8583
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
8684
$service = $container->get('bazinga_geocoder.provider.acme');
@@ -90,16 +88,17 @@ public function testBundleWithOneProviderConfiguration(): void
9088

9189
public function testBundleWithCachedProvider(): void
9290
{
93-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
91+
self::bootKernel(['config' => static function (TestKernel $kernel) {
9492
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
95-
$kernel->addTestConfig(__DIR__.'/config/cache.yml');
9693

97-
if ($kernel::VERSION_ID >= 50000) {
98-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
94+
if ($kernel::VERSION_ID >= 60000) {
95+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
9996
}
97+
98+
$kernel->addTestConfig(__DIR__.'/config/cache.yml');
10099
}]);
101100

102-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
101+
$container = self::getContainer();
103102

104103
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
105104
$service = $container->get('bazinga_geocoder.provider.acme');
@@ -111,16 +110,17 @@ public function testBundleWithCachedProvider(): void
111110

112111
public function testCacheLifetimeCanBeNull(): void
113112
{
114-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
113+
self::bootKernel(['config' => static function (TestKernel $kernel) {
115114
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
116-
$kernel->addTestConfig(__DIR__.'/config/cache_without_lifetime.yml');
117115

118-
if ($kernel::VERSION_ID >= 50000) {
119-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
116+
if ($kernel::VERSION_ID >= 60000) {
117+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
120118
}
119+
120+
$kernel->addTestConfig(__DIR__.'/config/cache_without_lifetime.yml');
121121
}]);
122122

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

125125
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
126126

@@ -140,16 +140,17 @@ public function testCacheLifetimeCanBeNull(): void
140140

141141
public function testBundleWithPluginsYml(): void
142142
{
143-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
143+
self::bootKernel(['config' => static function (TestKernel $kernel) {
144144
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
145-
$kernel->addTestConfig(__DIR__.'/config/service_plugin.yml');
146145

147-
if ($kernel::VERSION_ID >= 50000) {
148-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
146+
if ($kernel::VERSION_ID >= 60000) {
147+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
149148
}
149+
150+
$kernel->addTestConfig(__DIR__.'/config/service_plugin.yml');
150151
}]);
151152

152-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
153+
$container = self::getContainer();
153154

154155
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
155156
$service = $container->get('bazinga_geocoder.provider.acme');
@@ -161,16 +162,17 @@ public function testBundleWithPluginsYml(): void
161162

162163
public function testBundleWithPluginXml(): void
163164
{
164-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
165+
self::bootKernel(['config' => static function (TestKernel $kernel) {
165166
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
166-
$kernel->addTestConfig(__DIR__.'/config/service_plugin.xml');
167167

168-
if ($kernel::VERSION_ID >= 50000) {
169-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
168+
if ($kernel::VERSION_ID >= 60000) {
169+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
170170
}
171+
172+
$kernel->addTestConfig(__DIR__.'/config/service_plugin.xml');
171173
}]);
172174

173-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
175+
$container = self::getContainer();
174176

175177
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
176178
$service = $container->get('bazinga_geocoder.provider.acme');
@@ -182,15 +184,15 @@ public function testBundleWithPluginXml(): void
182184

183185
public function testBundleHasRegisteredDumpers(): void
184186
{
185-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
187+
self::bootKernel(['config' => static function (TestKernel $kernel) {
186188
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
187189

188-
if ($kernel::VERSION_ID >= 50000) {
189-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
190+
if ($kernel::VERSION_ID >= 60000) {
191+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
190192
}
191193
}]);
192194

193-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
195+
$container = self::getContainer();
194196

195197
self::assertTrue($container->has(GeoArray::class));
196198
self::assertTrue($container->has(GeoJson::class));

‎tests/Functional/CustomTestKernel.php

+4-29
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

1515
use Nyholm\BundleTest\TestKernel;
1616
use Symfony\Component\Config\ConfigCache;
17-
use Symfony\Component\Debug\DebugClassLoader as LegacyDebugClassLoader;
1817
use Symfony\Component\DependencyInjection\Dumper\Preloader;
1918
use Symfony\Component\ErrorHandler\DebugClassLoader;
20-
use Symfony\Component\Filesystem\Filesystem;
19+
use Symfony\Component\HttpKernel\CacheWarmer\WarmableInterface;
2120

2221
/*
2322
* Needed by PluginInteractionTest, so the test uses the cache for geoCoder, and doesn't clear it each time
@@ -114,23 +113,15 @@ protected function initializeContainer(): void
114113
} catch (\Throwable $e) {
115114
}
116115

117-
$oldContainer = \is_object($this->container) ? new \ReflectionClass($this->container) : $this->container = null;
118-
119116
try {
120-
is_dir($buildDir) ?: mkdir($buildDir, 0777, true);
117+
is_dir($buildDir) || mkdir($buildDir, 0777, true);
121118

122119
if ($lock = fopen($cachePath.'.lock', 'w')) {
123120
if (!flock($lock, \LOCK_EX | \LOCK_NB, $wouldBlock) && !flock($lock, $wouldBlock ? \LOCK_SH : \LOCK_EX)) {
124121
fclose($lock);
125122
$lock = null;
126-
} elseif (true || !\is_object($this->container = include $cachePath)) {
123+
} else {
127124
$this->container = null;
128-
} elseif (!$oldContainer || \get_class($this->container) !== $oldContainer->name) {
129-
flock($lock, \LOCK_UN);
130-
fclose($lock);
131-
$this->container->set('kernel', $this);
132-
133-
return;
134125
}
135126
}
136127
} catch (\Throwable $e) {
@@ -173,7 +164,7 @@ protected function initializeContainer(): void
173164

174165
// Remove frames added by DebugClassLoader.
175166
for ($i = \count($backtrace) - 2; 0 < $i; --$i) {
176-
if (\in_array($backtrace[$i]['class'] ?? null, [DebugClassLoader::class, LegacyDebugClassLoader::class], true)) {
167+
if ($backtrace[$i]['class'] ?? null === DebugClassLoader::class) {
177168
$backtrace = [$backtrace[$i + 1]];
178169
break;
179170
}
@@ -215,22 +206,6 @@ protected function initializeContainer(): void
215206
$this->container = require $cachePath;
216207
$this->container->set('kernel', $this);
217208

218-
if ($oldContainer && \get_class($this->container) !== $oldContainer->name) {
219-
// Because concurrent requests might still be using them,
220-
// old container files are not removed immediately,
221-
// but on a next dump of the container.
222-
static $legacyContainers = [];
223-
$oldContainerDir = \dirname($oldContainer->getFileName());
224-
$legacyContainers[$oldContainerDir.'.legacy'] = true;
225-
foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy', \GLOB_NOSORT) as $legacyContainer) {
226-
if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
227-
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
228-
}
229-
}
230-
231-
touch($oldContainerDir.'.legacy');
232-
}
233-
234209
$preload = $this instanceof WarmableInterface ? (array) $this->warmUp($this->container->getParameter('kernel.cache_dir')) : [];
235210

236211
if ($this->container->has('cache_warmer')) {

‎tests/Functional/GeocoderListenerTest.php

+36-36
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Bazinga\GeocoderBundle\Tests\Functional\Fixtures\Entity\DummyWithGetter;
1818
use Bazinga\GeocoderBundle\Tests\Functional\Fixtures\Entity\DummyWithInvalidGetter;
1919
use Bazinga\GeocoderBundle\Tests\Functional\Fixtures\Entity\DummyWithProperty;
20-
use Bazinga\GeocoderBundle\Tests\PublicServicePass;
2120
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
2221
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
2322
use Doctrine\ORM\Configuration;
@@ -41,9 +40,7 @@ final class GeocoderListenerTest extends KernelTestCase
4140
{
4241
protected function tearDown(): void
4342
{
44-
$container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
45-
46-
$em = $container->get('doctrine.orm.entity_manager');
43+
$em = self::getContainer()->get('doctrine.orm.entity_manager');
4744

4845
$tool = new SchemaTool($em);
4946
$tool->dropSchema($em->getMetadataFactory()->getAllMetadata());
@@ -62,8 +59,6 @@ protected static function createKernel(array $options = []): KernelInterface
6259
$kernel = parent::createKernel($options);
6360
$kernel->addTestBundle(DoctrineBundle::class);
6461
$kernel->addTestBundle(BazingaGeocoderBundle::class);
65-
$kernel->addTestCompilerPass(new PublicServicePass('|[Bb]azinga:*|'));
66-
$kernel->addTestCompilerPass(new PublicServicePass('|[gG]eocoder:*|'));
6762
if (defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP')) {
6863
$kernel->addTestConfig(static function (ContainerBuilder $container) {
6964
$container->prependExtensionConfig('doctrine', [
@@ -98,17 +93,18 @@ protected static function createKernel(array $options = []): KernelInterface
9893

9994
public function testPersistForProperty(): void
10095
{
101-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
96+
self::bootKernel(['config' => static function (TestKernel $kernel) {
10297
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
103-
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
104-
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
10598

106-
if ($kernel::VERSION_ID >= 50000) {
107-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
99+
if ($kernel::VERSION_ID >= 60000) {
100+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
108101
}
102+
103+
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
104+
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
109105
}]);
110106

111-
$container = $kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
107+
$container = self::getContainer();
112108

113109
$httpClient = $container->get(Client::class);
114110
$httpClient->on(new RequestMatcher(), function (RequestInterface $request) {
@@ -175,17 +171,18 @@ public function testPersistForProperty(): void
175171

176172
public function testPersistForGetter(): void
177173
{
178-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
174+
self::bootKernel(['config' => static function (TestKernel $kernel) {
179175
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
180-
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
181-
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
182176

183-
if ($kernel::VERSION_ID >= 50000) {
184-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
177+
if ($kernel::VERSION_ID >= 60000) {
178+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
185179
}
180+
181+
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
182+
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
186183
}]);
187184

188-
$container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
185+
$container = self::getContainer();
189186

190187
$httpClient = $container->get(Client::class);
191188
$httpClient->on(new RequestMatcher(), function (RequestInterface $request) {
@@ -252,17 +249,18 @@ public function testPersistForGetter(): void
252249

253250
public function testPersistForInvalidGetter(): void
254251
{
255-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
252+
self::bootKernel(['config' => static function (TestKernel $kernel) {
256253
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
257-
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
258-
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
259254

260-
if ($kernel::VERSION_ID >= 50000) {
261-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
255+
if ($kernel::VERSION_ID >= 60000) {
256+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
262257
}
258+
259+
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
260+
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
263261
}]);
264262

265-
$container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
263+
$container = self::getContainer();
266264

267265
$em = $container->get('doctrine.orm.entity_manager');
268266

@@ -281,17 +279,18 @@ public function testPersistForInvalidGetter(): void
281279

282280
public function testPersistForEmptyProperty(): void
283281
{
284-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
282+
self::bootKernel(['config' => static function (TestKernel $kernel) {
285283
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
286-
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
287-
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
288284

289-
if ($kernel::VERSION_ID >= 50000) {
290-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
285+
if ($kernel::VERSION_ID >= 60000) {
286+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
291287
}
288+
289+
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
290+
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
292291
}]);
293292

294-
$container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
293+
$container = self::getContainer();
295294

296295
$em = $container->get('doctrine.orm.entity_manager');
297296

@@ -310,17 +309,18 @@ public function testPersistForEmptyProperty(): void
310309

311310
public function testDoesNotGeocodeIfAddressNotChanged(): void
312311
{
313-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
312+
self::bootKernel(['config' => static function (TestKernel $kernel) {
314313
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
315-
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
316-
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
317314

318-
if ($kernel::VERSION_ID >= 50000) {
319-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
315+
if ($kernel::VERSION_ID >= 60000) {
316+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
320317
}
318+
319+
$kernel->addTestConfig(__DIR__.'/config/listener.yml');
320+
$kernel->addTestConfig(__DIR__.'/config/listener_'.(PHP_VERSION_ID >= 80000 ? 'php8' : 'php7').'.yml');
321321
}]);
322322

323-
$container = Kernel::VERSION_ID >= 50000 ? self::getContainer() : self::$container;
323+
$container = self::getContainer();
324324

325325
$httpRequests = 0;
326326
$httpClient = $container->get(Client::class);

‎tests/Functional/PluginInteractionTest.php

+12-13
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Bazinga\GeocoderBundle\Tests\Functional;
1414

1515
use Bazinga\GeocoderBundle\BazingaGeocoderBundle;
16-
use Bazinga\GeocoderBundle\Tests\PublicServicePass;
1716
use Geocoder\Query\GeocodeQuery;
1817
use Nyholm\BundleTest\TestKernel;
1918
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
@@ -36,8 +35,6 @@ protected static function createKernel(array $options = []): KernelInterface
3635
*/
3736
$kernel = parent::createKernel($options);
3837
$kernel->addTestBundle(BazingaGeocoderBundle::class);
39-
$kernel->addTestCompilerPass(new PublicServicePass('|[Bb]azinga:*|'));
40-
$kernel->addTestCompilerPass(new PublicServicePass('|[gG]eocoder:*|'));
4138
$kernel->handleOptions($options);
4239

4340
return $kernel;
@@ -48,15 +45,16 @@ public function testCachePluginUsesIpFromFakeIpPlugin(): void
4845
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
4946
$kernel->setClearCacheAfterShutdown(false);
5047
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
51-
$kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml');
52-
$kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_cn.yml');
5348

54-
if ($kernel::VERSION_ID >= 50000) {
55-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
49+
if ($kernel::VERSION_ID >= 60000) {
50+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
5651
}
52+
53+
$kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml');
54+
$kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_cn.yml');
5755
}]);
5856
$kernel->setClearCacheAfterShutdown(false);
59-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
57+
$container = self::getContainer();
6058

6159
$geoPluginGeocoder = $container->get('bazinga_geocoder.provider.geoPlugin');
6260
$result = $geoPluginGeocoder->geocodeQuery(GeocodeQuery::create('::1'));
@@ -66,15 +64,16 @@ public function testCachePluginUsesIpFromFakeIpPlugin(): void
6664
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
6765
$kernel->setClearCacheAfterShutdown(false);
6866
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
69-
$kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml');
70-
$kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_fr.yml');
7167

72-
if ($kernel::VERSION_ID >= 50000) {
73-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
68+
if ($kernel::VERSION_ID >= 60000) {
69+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
7470
}
71+
72+
$kernel->addTestConfig(__DIR__.'/config/cache_symfony.yml');
73+
$kernel->addTestConfig(__DIR__.'/config/geo_plugin_fakeip_with_cache_fr.yml');
7574
}]);
7675
$kernel->setClearCacheAfterShutdown(false);
77-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
76+
$container = self::getContainer();
7877

7978
$geoPluginGeocoder = $container->get('bazinga_geocoder.provider.geoPlugin');
8079
$result = $geoPluginGeocoder->geocodeQuery(GeocodeQuery::create('::1'));

‎tests/Functional/ProviderFactoryTest.php

+13-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
namespace Bazinga\GeocoderBundle\Tests\Functional;
1414

1515
use Bazinga\GeocoderBundle\BazingaGeocoderBundle;
16-
use Bazinga\GeocoderBundle\Tests\PublicServicePass;
1716
use Geocoder\Provider\AlgoliaPlaces\AlgoliaPlaces;
1817
use Geocoder\Provider\ArcGISOnline\ArcGISOnline;
1918
use Geocoder\Provider\BingMaps\BingMaps;
@@ -64,8 +63,6 @@ protected static function createKernel(array $options = []): KernelInterface
6463
*/
6564
$kernel = parent::createKernel($options);
6665
$kernel->addTestBundle(BazingaGeocoderBundle::class);
67-
$kernel->addTestCompilerPass(new PublicServicePass('|[Bb]azinga:*|'));
68-
$kernel->addTestCompilerPass(new PublicServicePass('|[gG]eocoder:*|'));
6966
$kernel->handleOptions($options);
7067

7168
return $kernel;
@@ -79,16 +76,17 @@ protected static function createKernel(array $options = []): KernelInterface
7976
*/
8077
public function testProviderConfiguration(string $class, array $serviceNames): void
8178
{
82-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) use ($class) {
79+
self::bootKernel(['config' => static function (TestKernel $kernel) use ($class) {
8380
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
84-
$kernel->addTestConfig(__DIR__.'/config/provider/'.strtolower(substr($class, strrpos($class, '\\') + 1)).'.yml');
8581

86-
if ($kernel::VERSION_ID >= 50000) {
87-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
82+
if ($kernel::VERSION_ID >= 60000) {
83+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
8884
}
85+
86+
$kernel->addTestConfig(__DIR__.'/config/provider/'.strtolower(substr($class, strrpos($class, '\\') + 1)).'.yml');
8987
}]);
9088

91-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
89+
$container = self::getContainer();
9290

9391
foreach ($serviceNames as $name) {
9492
self::assertTrue($container->has('bazinga_geocoder.provider.'.$name));
@@ -141,22 +139,19 @@ public function getProviders(): iterable
141139
*/
142140
public function testProviderConfigurationWithDeprecatedHttplugClientOption(): void
143141
{
144-
$kernel = self::bootKernel(['config' => static function (TestKernel $kernel) {
142+
self::bootKernel(['config' => static function (TestKernel $kernel) {
145143
$kernel->addTestConfig(__DIR__.'/config/framework.yml');
146-
$kernel->addTestConfig(__DIR__.'/config/deprecated_httplug_client_option.yml');
147144

148-
if ($kernel::VERSION_ID >= 50000) {
149-
$kernel->addTestConfig(__DIR__.'/config/framework_'.($kernel::VERSION_ID >= 60000 ? 'sf6' : 'sf5').'.yml');
145+
if ($kernel::VERSION_ID >= 60000) {
146+
$kernel->addTestConfig(__DIR__.'/config/framework_sf6.yml');
150147
}
148+
149+
$kernel->addTestConfig(__DIR__.'/config/deprecated_httplug_client_option.yml');
151150
}]);
152151

153-
$container = method_exists(__CLASS__, 'getContainer') ? self::getContainer() : $kernel->getContainer();
152+
$container = self::getContainer();
154153

155-
if ($kernel::VERSION_ID >= 50000) {
156-
$this->expectDeprecation('Since willdurand/geocoder-bundle 5.19: The option "httplug_client" is deprecated, use "http_client" instead.');
157-
} else {
158-
$this->expectDeprecation('willdurand/geocoder-bundle');
159-
}
154+
$this->expectDeprecation('Since willdurand/geocoder-bundle 5.19: The option "httplug_client" is deprecated, use "http_client" instead.');
160155

161156
self::assertTrue($container->has('bazinga_geocoder.provider.acme'));
162157
$container->get('bazinga_geocoder.provider.acme');

‎tests/Functional/config/framework.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ framework:
55
cookie_secure: auto
66
cookie_samesite: lax
77
handler_id: null
8+
storage_factory_id: session.storage.factory.native
9+
router:
10+
utf8: true

‎tests/Functional/config/framework_sf5.yml

-5
This file was deleted.

‎tests/Functional/config/framework_sf6.yml

-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ framework:
33
handle_all_throwables: true
44
php_errors:
55
log: true
6-
session:
7-
storage_factory_id: session.storage.factory.mock_file
8-
router:
9-
utf8: true

‎tests/Functional/config/listener.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ doctrine:
77
path: '%kernel.cache_dir%/test.sqlite'
88
orm:
99
auto_generate_proxy_classes: true
10+
validate_xml_mapping: true
11+
report_fields_where_declared: true
1012
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
1113
auto_mapping: false
1214

@@ -20,5 +22,4 @@ bazinga_geocoder:
2022
http_client: '@Http\Mock\Client'
2123

2224
services:
23-
Http\Mock\Client:
24-
public: true
25+
Http\Mock\Client: ~

‎tests/PublicServicePass.php

-48
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.