You are here

public function ContainerTest::testCompile in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testCompile()

@covers Symfony\Component\DependencyInjection\Container::compile

File

vendor/symfony/dependency-injection/Tests/ContainerTest.php, line 81

Class

ContainerTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testCompile() {
  $sc = new Container(new ParameterBag(array(
    'foo' => 'bar',
  )));
  $this
    ->assertFalse($sc
    ->getParameterBag()
    ->isResolved(), '->compile() resolves the parameter bag');
  $sc
    ->compile();
  $this
    ->assertTrue($sc
    ->getParameterBag()
    ->isResolved(), '->compile() resolves the parameter bag');
  $this
    ->assertInstanceOf('Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag', $sc
    ->getParameterBag(), '->compile() changes the parameter bag to a FrozenParameterBag instance');
  $this
    ->assertEquals(array(
    'foo' => 'bar',
  ), $sc
    ->getParameterBag()
    ->all(), '->compile() copies the current parameters to the new parameter bag');
}