Ejemplo n.º 1
0
 /**
  * @covers Symfony\Components\DependencyInjection\Container::isFrozen
  */
 public function testIsFrozen()
 {
     $sc = new Container(new ParameterBag(array('foo' => 'bar')));
     $this->assertFalse($sc->isFrozen(), '->isFrozen() returns false if the parameters are not frozen');
     $sc->freeze();
     $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen');
 }
Ejemplo n.º 2
0
 /**
  * Freezes the container.
  *
  * This method does four things:
  *
  *  * The extension configurations are merged;
  *  * Parameter values are resolved;
  *  * The parameter bag is freezed;
  *  * Extension loading is disabled.
  */
 public function freeze()
 {
     $parameters = $this->parameterBag->all();
     $definitions = $this->definitions;
     $aliases = $this->aliases;
     foreach ($this->extensionContainers as $container) {
         $this->merge($container);
     }
     $this->extensionContainers = array();
     $this->addDefinitions($definitions);
     $this->addAliases($aliases);
     $this->parameterBag->add($parameters);
     parent::freeze();
 }