@@ -165,4 +165,74 @@ public function testLoadBasePaths()
165
165
$ this ->assertContainerBuilderHasParameter ('cmf_routing.dynamic.persistence.phpcr.admin_basepath ' , '/cms/routes ' );
166
166
$ this ->assertContainerBuilderHasParameter ('cmf_routing.dynamic.persistence.phpcr.route_basepaths ' , array ('/cms/routes ' , '/cms/test ' ));
167
167
}
168
+
169
+ public function testInitializerEnabled ()
170
+ {
171
+ $ this ->container ->setParameter (
172
+ 'kernel.bundles ' ,
173
+ array (
174
+ 'CmfRoutingBundle ' => true ,
175
+ 'SonataDoctrinePHPCRAdminBundle ' => true ,
176
+ )
177
+ );
178
+
179
+ $ this ->load (array (
180
+ 'dynamic ' => array (
181
+ 'enabled ' => true ,
182
+ 'persistence ' => array (
183
+ 'phpcr ' => array (
184
+ 'enabled ' => true ,
185
+ 'use_sonata_admin ' => true ,
186
+ 'enable_initializer ' => true ,
187
+ ),
188
+ ),
189
+ ),
190
+ ));
191
+
192
+ $ this ->assertContainerBuilderHasService ('cmf_routing.initializer ' , 'Doctrine\Bundle\PHPCRBundle\Initializer\GenericInitializer ' );
193
+ }
194
+
195
+ public function testInitializerDisabled ()
196
+ {
197
+ $ this ->container ->setParameter (
198
+ 'kernel.bundles ' ,
199
+ array (
200
+ 'CmfRoutingBundle ' => true ,
201
+ 'SonataDoctrinePHPCRAdminBundle ' => true ,
202
+ )
203
+ );
204
+
205
+ $ this ->load (array (
206
+ 'dynamic ' => array (
207
+ 'enabled ' => true ,
208
+ 'persistence ' => array (
209
+ 'phpcr ' => array (
210
+ 'enabled ' => true ,
211
+ 'use_sonata_admin ' => true ,
212
+ 'enable_initializer ' => false ,
213
+ ),
214
+ ),
215
+ ),
216
+ ));
217
+
218
+ $ this ->assertFalse ($ this ->container ->has ('cmf_routing.initializer ' ));
219
+ }
220
+
221
+ public function testInitializerDisabledWithoutSonata ()
222
+ {
223
+ $ this ->load (array (
224
+ 'dynamic ' => array (
225
+ 'enabled ' => true ,
226
+ 'persistence ' => array (
227
+ 'phpcr ' => array (
228
+ 'enabled ' => true ,
229
+ 'use_sonata_admin ' => false ,
230
+ ),
231
+ ),
232
+ ),
233
+ ));
234
+
235
+ $ this ->assertFalse ($ this ->container ->has ('cmf_routing.initializer ' ));
236
+ }
237
+
168
238
}
0 commit comments