public function testPlacesAutocompleteFormType() { $this->loadConfiguration($this->container, 'empty'); $this->container->compile(); $this->container->enterScope('request'); $this->assertInstanceOf('Ivory\\GoogleMapBundle\\Form\\Type\\PlacesAutocompleteType', $this->container->get('ivory_google_map.places_autocomplete.form.type')); $this->container->leaveScope('request'); }
public function testSynchronizedServiceWithScopes() { $container = new ContainerBuilder(); $container->addScope(new Scope('foo')); $container->register('baz', 'BazClass')->setSynthetic(true)->setSynchronized(true)->setScope('foo'); $container->register('bar', 'BarClass')->addMethodCall('setBaz', array(new Reference('baz', ContainerInterface::NULL_ON_INVALID_REFERENCE, false))); $container->compile(); $container->enterScope('foo'); $container->set('baz', $outerBaz = new \BazClass(), 'foo'); $this->assertSame($outerBaz, $container->get('bar')->getBaz()); $container->enterScope('foo'); $container->set('baz', $innerBaz = new \BazClass(), 'foo'); $this->assertSame($innerBaz, $container->get('bar')->getBaz()); $container->leaveScope('foo'); $this->assertNotSame($innerBaz, $container->get('bar')->getBaz()); $this->assertSame($outerBaz, $container->get('bar')->getBaz()); $container->leaveScope('foo'); }
public function leaveScope($name) { return $this->delegate->leaveScope($name); }