Skip to content

Commit

Permalink
[DependencyInjection] Test Definition and DefinitionDecorator exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Oct 27, 2011
1 parent 323f80d commit 4bbb685
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Expand Up @@ -69,4 +69,14 @@ public function testSetArgument()
$this->assertSame($def, $def->replaceArgument(0, 'foo'));
$this->assertEquals(array('index_0' => 'foo'), $def->getArguments());
}

/**
* @expectedException InvalidArgumentException
*/
public function testReplaceArgumentShouldRequireIntegerIndex()
{
$def = new DefinitionDecorator('foo');

$def->replaceArgument('0', 'foo');
}
}
Expand Up @@ -221,6 +221,28 @@ public function testSetArgument()
$this->assertSame(array('foo', 'bar'), $def->getArguments());
}

/**
* @expectedException OutOfBoundsException
*/
public function testGetArgumentShouldCheckBounds()
{
$def = new Definition('stdClass');

$def->addArgument('foo');
$def->getArgument(1);
}

/**
* @expectedException OutOfBoundsException
*/
public function testReplaceArgumentShouldCheckBounds()
{
$def = new Definition('stdClass');

$def->addArgument('foo');
$def->replaceArgument(1, 'bar');
}

public function testSetGetProperties()
{
$def = new Definition('stdClass');
Expand Down

0 comments on commit 4bbb685

Please sign in to comment.