10000 minor #16155 Added more tests for PropertyAccess (pierredup) · symfony/symfony@a954fea · GitHub
[go: up one dir, main page]

Skip to content

Commit a954fea

Browse files
committed
minor #16155 Added more tests for PropertyAccess (pierredup)
This PR was merged into the 2.7 branch. Discussion ---------- Added more tests for PropertyAccess | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | This is a follow up for [16090#issuecomment-145183635](#16090 (comment)) Commits ------- 378db75 Added more tests for PropertyAccess
2 parents 481f39d + 378db75 commit a954fea

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