13
13
namespace Bazinga \GeocoderBundle \Tests \Functional ;
14
14
15
15
use Bazinga \GeocoderBundle \BazingaGeocoderBundle ;
16
- use Bazinga \GeocoderBundle \Tests \PublicServicePass ;
17
16
use Geocoder \Dumper \GeoArray ;
18
17
use Geocoder \Dumper \GeoJson ;
19
18
use Geocoder \Dumper \Gpx ;
@@ -44,24 +43,22 @@ protected static function createKernel(array $options = []): KernelInterface
44
43
*/
45
44
$ kernel = parent ::createKernel ($ options );
46
45
$ kernel ->addTestBundle (BazingaGeocoderBundle::class);
47
- $ kernel ->addTestCompilerPass (new PublicServicePass ('|[Bb]azinga:*| ' ));
48
- $ kernel ->addTestCompilerPass (new PublicServicePass ('|[gG]eocoder:*| ' ));
49
46
$ kernel ->handleOptions ($ options );
50
47
51
48
return $ kernel ;
52
49
}
53
50
54
51
public function testInitBundle (): void
55
52
{
56
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
53
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
57
54
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
58
55
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 ' );
61
58
}
62
59
}]);
63
60
64
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
61
+ $ container = self ::getContainer ();
65
62
66
63
// Test if services exists
67
64
self ::assertTrue ($ container ->has (ProviderAggregator::class));
@@ -71,16 +68,17 @@ public function testInitBundle(): void
71
68
72
69
public function testBundleWithOneProviderConfiguration (): void
73
70
{
74
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
71
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
75
72
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
76
- $ kernel ->addTestConfig (__DIR__ .'/config/simple.yml ' );
77
73
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 ' );
80
76
}
77
+
78
+ $ kernel ->addTestConfig (__DIR__ .'/config/simple.yml ' );
81
79
}]);
82
80
83
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
81
+ $ container = self ::getContainer ();
84
82
85
83
self ::assertTrue ($ container ->has ('bazinga_geocoder.provider.acme ' ));
86
84
$ service = $ container ->get ('bazinga_geocoder.provider.acme ' );
@@ -90,16 +88,17 @@ public function testBundleWithOneProviderConfiguration(): void
90
88
91
89
public function testBundleWithCachedProvider (): void
92
90
{
93
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
91
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
94
92
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
95
- $ kernel ->addTestConfig (__DIR__ .'/config/cache.yml ' );
96
93
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 ' );
99
96
}
97
+
98
+ $ kernel ->addTestConfig (__DIR__ .'/config/cache.yml ' );
100
99
}]);
101
100
102
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
101
+ $ container = self ::getContainer ();
103
102
104
103
self ::assertTrue ($ container ->has ('bazinga_geocoder.provider.acme ' ));
105
104
$ service = $ container ->get ('bazinga_geocoder.provider.acme ' );
@@ -111,16 +110,17 @@ public function testBundleWithCachedProvider(): void
111
110
112
111
public function testCacheLifetimeCanBeNull (): void
113
112
{
114
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
113
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
115
114
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
116
- $ kernel ->addTestConfig (__DIR__ .'/config/cache_without_lifetime.yml ' );
117
115
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 ' );
120
118
}
119
+
120
+ $ kernel ->addTestConfig (__DIR__ .'/config/cache_without_lifetime.yml ' );
121
121
}]);
122
122
123
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
123
+ $ container = self ::getContainer ();
124
124
125
125
self ::assertTrue ($ container ->has ('bazinga_geocoder.provider.acme ' ));
126
126
@@ -140,16 +140,17 @@ public function testCacheLifetimeCanBeNull(): void
140
140
141
141
public function testBundleWithPluginsYml (): void
142
142
{
143
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
143
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
144
144
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
145
- $ kernel ->addTestConfig (__DIR__ .'/config/service_plugin.yml ' );
146
145
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 ' );
149
148
}
149
+
150
+ $ kernel ->addTestConfig (__DIR__ .'/config/service_plugin.yml ' );
150
151
}]);
151
152
152
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
153
+ $ container = self ::getContainer ();
153
154
154
155
self ::assertTrue ($ container ->has ('bazinga_geocoder.provider.acme ' ));
155
156
$ service = $ container ->get ('bazinga_geocoder.provider.acme ' );
@@ -161,16 +162,17 @@ public function testBundleWithPluginsYml(): void
161
162
162
163
public function testBundleWithPluginXml (): void
163
164
{
164
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
165
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
165
166
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
166
- $ kernel ->addTestConfig (__DIR__ .'/config/service_plugin.xml ' );
167
167
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 ' );
170
170
}
171
+
172
+ $ kernel ->addTestConfig (__DIR__ .'/config/service_plugin.xml ' );
171
173
}]);
172
174
173
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
175
+ $ container = self ::getContainer ();
174
176
175
177
self ::assertTrue ($ container ->has ('bazinga_geocoder.provider.acme ' ));
176
178
$ service = $ container ->get ('bazinga_geocoder.provider.acme ' );
@@ -182,15 +184,15 @@ public function testBundleWithPluginXml(): void
182
184
183
185
public function testBundleHasRegisteredDumpers (): void
184
186
{
185
- $ kernel = self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
187
+ self ::bootKernel (['config ' => static function (TestKernel $ kernel ) {
186
188
$ kernel ->addTestConfig (__DIR__ .'/config/framework.yml ' );
187
189
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 ' );
190
192
}
191
193
}]);
192
194
193
- $ container = method_exists ( __CLASS__ , ' getContainer ' ) ? self ::getContainer () : $ kernel -> getContainer ();
195
+ $ container = self ::getContainer ();
194
196
195
197
self ::assertTrue ($ container ->has (GeoArray::class));
196
198
self ::assertTrue ($ container ->has (GeoJson::class));
0 commit comments