[DependencyInjection] Test Definition and DefinitionDecorator exceptions
This commit is contained in:
parent
323f80d233
commit
4bbb685557
@ -69,4 +69,14 @@ class DefinitionDecoratorTest extends \PHPUnit_Framework_TestCase
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
@ -221,6 +221,28 @@ class DefinitionTest extends \PHPUnit_Framework_TestCase
|
||||
$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');
|
||||
|
Reference in New Issue
Block a user