8000 Added more tests for PropertyAccess · symfony/symfony@378db75 · GitHub
[go: up one dir, main page]

Skip to content

Commit 378db75

Browse files
committed
Added more tests for PropertyAccess
1 parent 380e2ba commit 378db75

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\PropertyAccess\Tests;
1313

14+
use Symfony\Component\PropertyAccess\Exception\NoSuchIndexException;
1415
use Symfony\Component\PropertyAccess\PropertyAccessor;
1516
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClass;
1617
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
@@ -139,6 +140,20 @@ public function testGetValueNotModifyObject()
139140
$this->assertSame(array('Bernhard'), $object->firstName);
140141
}
141142

143+
public function testGetValueNotModifyObjectException()
144+
{
145+
$propertyAccessor = new PropertyAccessor(false, true);
146+
$object = new \stdClass();
147+
$object->firstName = array('Bernhard');
148+
149+
try {
150+
$propertyAccessor->getValue($object, 'firstName[1]');
151+
} catch (NoSuchIndexException $e) {
152+
}
153+
154+
$this->assertSame(array('Bernhard'), $object->firstName);
155+
}
156+
142157
/**
143158
* @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
144159
*/

0 commit comments

Comments
 (0)
0