8000 [DependencyInjection] Test Definition and DefinitionDecorator exceptions · Kiruban2011/symfony@4bbb685 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bbb685

Browse files
committed
[DependencyInjection] Test Definition and DefinitionDecorator exceptions
1 parent 323f80d commit 4bbb685

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

tests/Symfony/Tests/Component/DependencyInjection/DefinitionDecoratorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,14 @@ public function testSetArgument()
6969
$this->assertSame($def, $def->replaceArgument(0, 'foo'));
7070
$this->assertEquals(array('index_0' => 'foo'), $def->getArguments());
7171
}
72+
73+
/**
74+
* @expectedException InvalidArgumentException
75+
*/
76+
public function testReplaceArgumentShouldRequireIntegerIndex()
77+
{
78+
$def = new DefinitionDecorator('foo');
79+
80+
$def->replaceArgument('0', 'foo');
81+
}
7282
}

tests/Symfony/Tests/Component/DependencyInjection/DefinitionTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,28 @@ public function testSetArgument()
221221
$this->assertSame(array('foo', 'bar'), $def->getArguments());
222222
}
223223

224+
/**
225+
* @expectedException OutOfBoundsException
226+
*/
227+
public function testGetArgumentShouldCheckBounds()
228+
{
229+
$def = new Definition('stdClass');
230+
231+
$def->addArgument('foo');
232+
$def->getArgument(1);
233+
}
234+
235+
/**
236+
* @expectedException OutOfBoundsException
237+
*/
238+
public function testReplaceArgumentShouldCheckBounds()
239+
{
240+
$def = new Definition('stdClass');
241+
242+
$def->addArgument('foo');
243+
$def->replaceArgument(1, 'bar');
244+
}
245+
224246
public function testSetGetProperties()
225247
{
226248
$def = new Definition('stdClass');

0 commit comments

Comments
 (0)
0