You are here

public function ContainerTest::testConstructor 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::testConstructor()

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

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/ContainerTest.php, line 25

Class

ContainerTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testConstructor() {
  $sc = new Container();
  $this
    ->assertSame($sc, $sc
    ->get('service_container'), '__construct() automatically registers itself as a service');
  $sc = new Container(new ParameterBag(array(
    'foo' => 'bar',
  )));
  $this
    ->assertEquals(array(
    'foo' => 'bar',
  ), $sc
    ->getParameterBag()
    ->all(), '__construct() takes an array of parameters as its first argument');
}