@@ -48,41 +48,28 @@ protected function setUp()
4848 }
4949 }
5050
51- /**
52- * Call this method (optionally) form within your test after you have (optionally) modified the ContainerBuilder
53- * for this test ($this->container), but BEFORE you call load method ($this->load()) - if your extension(s) implements
54- * \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface
55- *
56- * @see http://symfony.com/doc/current/bundles/prepend_extension.html
57- * @see \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface
58- */
59- protected function prepend ()
60- {
61- if ($ this ->loadMethodInvoked ) {
62- throw new \LogicException (sprintf ('Method "prepend()" from "%s" must not be invoked after "load()" method. ' , PrependExtensionInterface::class));
63- }
64-
65- foreach ($ this ->container ->getExtensions () as $ extension ) {
66-
67- if ($ extension instanceof PrependExtensionInterface) {
68- $ extension ->prepend ($ this ->container );
69- }
70- }
71- }
72-
7351 /**
7452 * Call this method from within your test after you have (optionally) modified the ContainerBuilder for this test
7553 * ($this->container).
7654 *
77- * @param array $specificConfiguration
55+ * If your extension(s) implements \Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface, you may
56+ * set $withPrependInvocation to TRUE to invoke prepend() method prior to load() method of your extension.
57+ *
58+ * @param array $configurationValues
59+ * @param bool $withPrependInvocation
7860 */
79- protected function load (array $ configurationValues = array ())
61+ protected function load (array $ configurationValues = array (), $ withPrependInvocation = false )
8062 {
8163 $ this ->loadMethodInvoked = true ;
8264
8365 $ configs = array ($ this ->getMinimalConfiguration (), $ configurationValues );
8466
8567 foreach ($ this ->container ->getExtensions () as $ extension ) {
68+
69+ if ($ withPrependInvocation && $ extension instanceof PrependExtensionInterface) {
70+ $ extension ->prepend ($ this ->container );
71+ }
72+
8673 $ extension ->load ($ configs , $ this ->container );
8774 }
8875 }
0 commit comments