File tree 1 file changed +15
-0
lines changed
src/Symfony/Component/PropertyAccess/Tests
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \PropertyAccess \Tests ;
13
13
14
+ use Symfony \Component \PropertyAccess \Exception \NoSuchIndexException ;
14
15
use Symfony \Component \PropertyAccess \PropertyAccessor ;
15
16
use Symfony \Component \PropertyAccess \Tests \Fixtures \TestClass ;
16
17
use Symfony \Component \PropertyAccess \Tests \Fixtures \TestClassMagicCall ;
@@ -139,6 +140,20 @@ public function testGetValueNotModifyObject()
139
140
$ this ->assertSame (array ('Bernhard ' ), $ object ->firstName );
140
141
}
141
142
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
+
142
157
/**
143
158
* @expectedException \Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException
144
159
*/
You can’t perform that action at this time.
0 commit comments