You are here

public function ContainerTest::testCompile in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php \Symfony\Component\DependencyInjection\Tests\ContainerTest::testCompile()

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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');
}