@@ -69,7 +69,6 @@ public function testCreateDeprecatedService()
6969
7070 $ builder = new ContainerBuilder ();
7171 $ builder ->setDefinition ('deprecated_foo ' , $ definition );
72- $ builder ->compile ();
7372 $ builder ->get ('deprecated_foo ' );
7473 }
7574
@@ -98,14 +97,12 @@ public function testHas()
9897 public function testGetThrowsExceptionIfServiceDoesNotExist ()
9998 {
10099 $ builder = new ContainerBuilder ();
101- $ builder ->compile ();
102100 $ builder ->get ('foo ' );
103101 }
104102
105103 public function testGetReturnsNullIfServiceDoesNotExistAndInvalidReferenceIsUsed ()
106104 {
107105 $ builder = new ContainerBuilder ();
108- $ builder ->compile ();
109106
110107 $ this ->assertNull ($ builder ->get ('foo ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ), '->get() returns null if the service does not exist and NULL_ON_INVALID_REFERENCE is passed as a second argument ' );
111108 }
@@ -117,15 +114,13 @@ public function testGetThrowsCircularReferenceExceptionIfServiceHasReferenceToIt
117114 {
118115 $ builder = new ContainerBuilder ();
119116 $ builder ->register ('baz ' , 'stdClass ' )->setArguments (array (new Reference ('baz ' )));
120- $ builder ->compile ();
121117 $ builder ->get ('baz ' );
122118 }
123119
124120 public function testGetReturnsSameInstanceWhenServiceIsShared ()
125121 {
126122 $ builder = new ContainerBuilder ();
127123 $ builder ->register ('bar ' , 'stdClass ' );
128- $ builder ->compile ();
129124
130125 $ this ->assertTrue ($ builder ->get ('bar ' ) === $ builder ->get ('bar ' ), '->get() always returns the same instance if the service is shared ' );
131126 }
@@ -134,7 +129,6 @@ public function testGetCreatesServiceBasedOnDefinition()
134129 {
135130 $ builder = new ContainerBuilder ();
136131 $ builder ->register ('foo ' , 'stdClass ' );
137- $ builder ->compile ();
138132
139133 $ this ->assertInternalType ('object ' , $ builder ->get ('foo ' ), '->get() returns the service definition associated with the id ' );
140134 }
@@ -143,7 +137,6 @@ public function testGetReturnsRegisteredService()
143137 {
144138 $ builder = new ContainerBuilder ();
145139 $ builder ->set ('bar ' , $ bar = new \stdClass ());
146- $ builder ->compile ();
147140
148141 $ this ->assertSame ($ bar , $ builder ->get ('bar ' ), '->get() returns the service associated with the id ' );
149142 }
@@ -153,7 +146,6 @@ public function testRegisterDoesNotOverrideExistingService()
153146 $ builder = new ContainerBuilder ();
154147 $ builder ->set ('bar ' , $ bar = new \stdClass ());
155148 $ builder ->register ('bar ' , 'stdClass ' );
156- $ builder ->compile ();
157149
158150 $ this ->assertSame ($ bar , $ builder ->get ('bar ' ), '->get() returns the service associated with the id even if a definition has been defined ' );
159151 }
@@ -163,8 +155,6 @@ public function testNonSharedServicesReturnsDifferentInstances()
163155 $ builder = new ContainerBuilder ();
164156 $ builder ->register ('bar ' , 'stdClass ' )->setShared (false );
165157
166- $ builder ->compile ();
167-
168158 $ this ->assertNotSame ($ builder ->get ('bar ' ), $ builder ->get ('bar ' ));
169159 }
170160
@@ -177,8 +167,6 @@ public function testGetUnsetLoadingServiceWhenCreateServiceThrowsAnException()
177167 $ builder = new ContainerBuilder ();
178168 $ builder ->register ('foo ' , 'stdClass ' )->setSynthetic (true );
179169
180- $ builder ->compile ();
181-
182170 // we expect a RuntimeException here as foo is synthetic
183171 try {
184172 $ builder ->get ('foo ' );
@@ -207,9 +195,6 @@ public function testAliases()
207195 $ this ->assertFalse ($ builder ->hasAlias ('foobar ' ), '->hasAlias() returns false if the alias does not exist ' );
208196 $ this ->assertEquals ('foo ' , (string ) $ builder ->getAlias ('bar ' ), '->getAlias() returns the aliased service ' );
209197 $ this ->assertTrue ($ builder ->has ('bar ' ), '->setAlias() defines a new service ' );
210-
211- $ builder ->compile ();
212-
213198 $ this ->assertTrue ($ builder ->get ('bar ' ) === $ builder ->get ('foo ' ), '->setAlias() creates a service that is an alias to another one ' );
214199
215200 try {
@@ -277,9 +262,6 @@ public function testSetReplacesAlias()
277262 $ builder ->set ('aliased ' , new \stdClass ());
278263
279264 $ builder ->set ('alias ' , $ foo = new \stdClass ());
280-
281- $ builder ->compile ();
282-
283265 $ this ->assertSame ($ foo , $ builder ->get ('alias ' ), '->set() replaces an existing alias ' );
284266 }
285267
@@ -303,9 +285,6 @@ public function testCreateService()
303285 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->setFile (__DIR__ .'/Fixtures/includes/foo.php ' );
304286 $ builder ->register ('foo2 ' , 'Bar\FooClass ' )->setFile (__DIR__ .'/Fixtures/includes/%file%.php ' );
305287 $ builder ->setParameter ('file ' , 'foo ' );
306-
307- $ builder ->compile ();
308-
309288 $ this ->assertInstanceOf ('\Bar\FooClass ' , $ builder ->get ('foo1 ' ), '->createService() requires the file defined by the service definition ' );
310289 $ this ->assertInstanceOf ('\Bar\FooClass ' , $ builder ->get ('foo2 ' ), '->createService() replaces parameters in the file provided by the service definition ' );
311290 }
@@ -317,8 +296,6 @@ public function testCreateProxyWithRealServiceInstantiator()
317296 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->setFile (__DIR__ .'/Fixtures/includes/foo.php ' );
318297 $ builder ->getDefinition ('foo1 ' )->setLazy (true );
319298
320- $ builder ->compile ();
321-
322299 $ foo1 = $ builder ->get ('foo1 ' );
323300
324301 $ this ->assertSame ($ foo1 , $ builder ->get ('foo1 ' ), 'The same proxy is retrieved on multiple subsequent calls ' );
@@ -330,9 +307,6 @@ public function testCreateServiceClass()
330307 $ builder = new ContainerBuilder ();
331308 $ builder ->register ('foo1 ' , '%class% ' );
332309 $ builder ->setParameter ('class ' , 'stdClass ' );
333-
334- $ builder ->compile ();
335-
336310 $ this ->assertInstanceOf ('\stdClass ' , $ builder ->get ('foo1 ' ), '->createService() replaces parameters in the class provided by the service definition ' );
337311 }
338312
@@ -342,9 +316,6 @@ public function testCreateServiceArguments()
342316 $ builder ->register ('bar ' , 'stdClass ' );
343317 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->addArgument (array ('foo ' => '%value% ' , '%value% ' => 'foo ' , new Reference ('bar ' ), '%%unescape_it%% ' ));
344318 $ builder ->setParameter ('value ' , 'bar ' );
345-
346- $ builder ->compile ();
347-
348319 $ this ->assertEquals (array ('foo ' => 'bar ' , 'bar ' => 'foo ' , $ builder ->get ('bar ' ), '%unescape_it% ' ), $ builder ->get ('foo1 ' )->arguments , '->createService() replaces parameters and service references in the arguments provided by the service definition ' );
349320 }
350321
@@ -356,8 +327,6 @@ public function testCreateServiceFactory()
356327 $ builder ->register ('bar ' , 'Bar\FooClass ' )->setFactory (array (new Definition ('Bar\FooClass ' ), 'getInstance ' ));
357328 $ builder ->register ('baz ' , 'Bar\FooClass ' )->setFactory (array (new Reference ('bar ' ), 'getInstance ' ));
358329
359- $ builder ->compile ();
360-
361330 $ this ->assertTrue ($ builder ->get ('foo ' )->called , '->createService() calls the factory method to create the service instance ' );
362331 $ this ->assertTrue ($ builder ->get ('qux ' )->called , '->createService() calls the factory method to create the service instance ' );
363332 $ this ->assertTrue ($ builder ->get ('bar ' )->called , '->createService() uses anonymous service as factory ' );
@@ -370,9 +339,6 @@ public function testCreateServiceMethodCalls()
370339 $ builder ->register ('bar ' , 'stdClass ' );
371340 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->addMethodCall ('setBar ' , array (array ('%value% ' , new Reference ('bar ' ))));
372341 $ builder ->setParameter ('value ' , 'bar ' );
373-
374- $ builder ->compile ();
375-
376342 $ this ->assertEquals (array ('bar ' , $ builder ->get ('bar ' )), $ builder ->get ('foo1 ' )->bar , '->createService() replaces the values in the method calls arguments ' );
377343 }
378344
@@ -382,9 +348,6 @@ public function testCreateServiceMethodCallsWithEscapedParam()
382348 $ builder ->register ('bar ' , 'stdClass ' );
383349 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->addMethodCall ('setBar ' , array (array ('%%unescape_it%% ' )));
384350 $ builder ->setParameter ('value ' , 'bar ' );
385-
386- $ builder ->compile ();
387-
388351 $ this ->assertEquals (array ('%unescape_it% ' ), $ builder ->get ('foo1 ' )->bar , '->createService() replaces the values in the method calls arguments ' );
389352 }
390353
@@ -394,9 +357,6 @@ public function testCreateServiceProperties()
394357 $ builder ->register ('bar ' , 'stdClass ' );
395358 $ builder ->register ('foo1 ' , 'Bar\FooClass ' )->setProperty ('bar ' , array ('%value% ' , new Reference ('bar ' ), '%%unescape_it%% ' ));
396359 $ builder ->setParameter ('value ' , 'bar ' );
397-
398- $ builder ->compile ();
399-
400360 $ this ->assertEquals (array ('bar ' , $ builder ->get ('bar ' ), '%unescape_it% ' ), $ builder ->get ('foo1 ' )->bar , '->createService() replaces the values in the properties ' );
401361 }
402362
@@ -411,8 +371,6 @@ public function testCreateServiceConfigurator()
411371 $ builder ->register ('foo4 ' , 'Bar\FooClass ' )->setConfigurator (array ($ builder ->getDefinition ('baz ' ), 'configure ' ));
412372 $ builder ->register ('foo5 ' , 'Bar\FooClass ' )->setConfigurator ('foo ' );
413373
414- $ builder ->compile ();
415-
416374 $ this ->assertTrue ($ builder ->get ('foo1 ' )->configured , '->createService() calls the configurator ' );
417375 $ this ->assertTrue ($ builder ->get ('foo2 ' )->configured , '->createService() calls the configurator ' );
418376 $ this ->assertTrue ($ builder ->get ('foo3 ' )->configured , '->createService() calls the configurator ' );
@@ -433,9 +391,6 @@ public function testCreateSyntheticService()
433391 {
434392 $ builder = new ContainerBuilder ();
435393 $ builder ->register ('foo ' , 'Bar\FooClass ' )->setSynthetic (true );
436-
437- $ builder ->compile ();
438-
439394 $ builder ->get ('foo ' );
440395 }
441396
@@ -445,18 +400,13 @@ public function testCreateServiceWithExpression()
445400 $ builder ->setParameter ('bar ' , 'bar ' );
446401 $ builder ->register ('bar ' , 'BarClass ' );
447402 $ builder ->register ('foo ' , 'Bar\FooClass ' )->addArgument (array ('foo ' => new Expression ('service("bar").foo ~ parameter("bar") ' )));
448-
449- $ builder ->compile ();
450-
451403 $ this ->assertEquals ('foobar ' , $ builder ->get ('foo ' )->arguments ['foo ' ]);
452404 }
453405
454406 public function testResolveServices ()
455407 {
456408 $ builder = new ContainerBuilder ();
457409 $ builder ->register ('foo ' , 'Bar\FooClass ' );
458- $ builder ->compile ();
459-
460410 $ this ->assertEquals ($ builder ->get ('foo ' ), $ builder ->resolveServices (new Reference ('foo ' )), '->resolveServices() resolves service references to service instances ' );
461411 $ this ->assertEquals (array ('foo ' => array ('foo ' , $ builder ->get ('foo ' ))), $ builder ->resolveServices (array ('foo ' => array ('foo ' , new Reference ('foo ' )))), '->resolveServices() resolves service references to service instances in nested arrays ' );
462412 $ this ->assertEquals ($ builder ->get ('foo ' ), $ builder ->resolveServices (new Expression ('service("foo") ' )), '->resolveServices() resolves expressions ' );
0 commit comments