You are here

public function DefinitionTest::testSetArgument in Service Container 7.2

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

@covers Symfony\Component\DependencyInjection\Definition::replaceArgument

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php, line 273

Class

DefinitionTest

Namespace

Symfony\Component\DependencyInjection\Tests

Code

public function testSetArgument() {
  $def = new Definition('stdClass');
  $def
    ->addArgument('foo');
  $this
    ->assertSame(array(
    'foo',
  ), $def
    ->getArguments());
  $this
    ->assertSame($def, $def
    ->replaceArgument(0, 'moo'));
  $this
    ->assertSame(array(
    'moo',
  ), $def
    ->getArguments());
  $def
    ->addArgument('moo');
  $def
    ->replaceArgument(0, 'foo')
    ->replaceArgument(1, 'bar');
  $this
    ->assertSame(array(
    'foo',
    'bar',
  ), $def
    ->getArguments());
}