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->compile(); $this->assertTrue($sc->isFrozen(), '->isFrozen() returns true if the parameters are frozen'); }
/** * Returns ContainerBuilder by including the default file 'containerBuilder.php' from settings directory. * * @throws \RuntimeException */ protected function getContainer() { if ($this->innerContainer instanceof ContainerInterface) { // Do nothing } elseif (!is_readable($this->innerContainer)) { throw new RuntimeException(sprintf("Unable to read file %s\n", $this->innerContainer)); } else { // 'containerBuilder.php' file expects $installDir variable to be set by caller $installDir = $this->installDir; $this->innerContainer = (require_once $this->innerContainer); } // Compile container if necessary if ($this->innerContainer instanceof ContainerBuilder && !$this->innerContainer->isFrozen()) { $this->innerContainer->compile(); } }