2121class  ContainerBuilderTest extends  TestCase
2222{
2323 use  EasyMock;
24+ 
25+ private  static  function  getProperty (object $ objectstring  $ propertyName
26+ {
27+ return  (function  (string  $ propertyName
28+ return  $ this $ propertyName
29+ })->bindTo ($ object$ object$ propertyName
30+ }
2431
2532 /** 
2633 * @test 
2734 */ 
2835 public  function  should_configure_for_development_by_default ()
2936 {
30-  $ getPropertyfunction  (object $ objectstring  $ propertyName
31-  return  (function  (string  $ propertyName
32-  return  $ this $ propertyName
33-  })->bindTo ($ object$ object$ propertyName
34-  };
35- 
3637 // Make the ContainerBuilder use our fake class to catch constructor parameters 
3738 $ buildernew  ContainerBuilder (FakeContainer::class);
3839 /** @var FakeContainer $container */ 
@@ -41,7 +42,7 @@ public function should_configure_for_development_by_default()
4142 // Not compiled 
4243 $ this assertNotInstanceOf (CompiledContainer::class, $ container
4344 // Proxies evaluated in memory 
44-  $ this assertNull ($ getProperty$ containerproxyFactory , 'proxyDirectory ' ));
45+  $ this assertNull (self :: getProperty ($ containerproxyFactory , 'proxyDirectory ' ));
4546 }
4647
4748 /** 
@@ -248,4 +249,28 @@ public function should_throw_if_modified_after_building_a_container()
248249
249250 $ builderaddDefinitions ([]);
250251 }
252+ 
253+  /** 
254+  * @test 
255+  */ 
256+  public  function  should_create_proxies ()
257+  {
258+  $ buildernew  ContainerBuilder (FakeContainer::class);
259+  $ builderwriteProxiesToFile (true , 'somedir ' );
260+  $ container$ builderbuild ();
261+ 
262+  $ this assertSame ('somedir ' , self ::getProperty ($ containerproxyFactory , 'proxyDirectory ' ));
263+  }
264+ 
265+  /** 
266+  * @test 
267+  */ 
268+  public  function  should_not_create_proxies ()
269+  {
270+  $ buildernew  ContainerBuilder (FakeContainer::class);
271+  $ builderwriteProxiesToFile (false , 'somedir ' );
272+  $ container$ builderbuild ();
273+ 
274+  $ this assertNull (self ::getProperty ($ containerproxyFactory , 'proxyDirectory ' ));
275+  }
251276}
0 commit comments