@@ -375,4 +375,32 @@ public function testTicket5755()
375
375
376
376
$ this ->assertEquals ('foobar ' , $ object ->getProperty ());
377
377
}
378
+
379
+ /**
380
+ * @dataProvider getValidPropertyPaths
381
+ */
382
+ public function testSetValue ($ objectOrArray , $ path )
383
+ {
384
+ $ this ->propertyAccessor ->setValue ($ objectOrArray , $ path , 'Updated ' );
385
+
386
+ $ this ->assertSame ('Updated ' , $ this ->propertyAccessor ->getValue ($ objectOrArray , $ path ));
387
+ }
388
+
389
+ public function getValidPropertyPaths ()
390
+ {
391
+ return array (
392
+ array (array ('Bernhard ' , 'Schussek ' ), '[0] ' , 'Bernhard ' ),
393
+ array (array ('Bernhard ' , 'Schussek ' ), '[1] ' , 'Schussek ' ),
394
+ array (array ('firstName ' => 'Bernhard ' ), '[firstName] ' , 'Bernhard ' ),
395
+ array (array ('index ' => array ('firstName ' => 'Bernhard ' )), '[index][firstName] ' , 'Bernhard ' ),
396
+ array ((object ) array ('firstName ' => 'Bernhard ' ), 'firstName ' , 'Bernhard ' ),
397
+ array ((object ) array ('property ' => array ('firstName ' => 'Bernhard ' )), 'property[firstName] ' , 'Bernhard ' ),
398
+ array (array ('index ' => (object ) array ('firstName ' => 'Bernhard ' )), '[index].firstName ' , 'Bernhard ' ),
399
+ array ((object ) array ('property ' => (object ) array ('firstName ' => 'Bernhard ' )), 'property.firstName ' , 'Bernhard ' ),
400
+
401
+ // Missing indices
402
+ array (array ('index ' => array ()), '[index][firstName] ' , null ),
403
+ array (array ('root ' => array ('index ' => array ())), '[root][index][firstName] ' , null ),
404
+ );
405
+ }
378
406
}
0 commit comments