@@ -70,32 +70,29 @@ public function testGetValueThrowsExceptionIfIndexNotationExpected()
70
70
$ this ->getPropertyAccessor ()->getValue ($ array , 'firstName ' );
71
71
}
72
72
73
- public function testGetValueReadsZeroIndex ()
74
- {
75
- $ array = array ('Bernhard ' );
76
-
77
- $ this ->assertEquals ('Bernhard ' , $ this ->getPropertyAccessor ()->getValue ($ array , '[0] ' ));
78
- }
79
-
80
- public function testGetValueReadsIndexWithSpecialChars ()
73
+ /**
74
+ * @dataProvider provideValueReads
75
+ */
76
+ public function testGetValueReads ($ propertyPath , $ expectedValue , $ testedData )
81
77
{
82
- $ array = array ('%!@$§. ' => 'Bernhard ' );
83
-
84
- $ this ->assertEquals ('Bernhard ' , $ this ->getPropertyAccessor ()->getValue ($ array , '[%!@$§.] ' ));
78
+ $ this ->assertEquals ($ expectedValue , $ this ->getPropertyAccessor ()->getValue ($ testedData , $ propertyPath ));
85
79
}
86
80
87
- public function testGetValueReadsNestedIndexWithSpecialChars ()
81
+ public function provideValueReads ()
88
82
{
89
- $ array = array ('root ' => array ('%!@$§. ' => 'Bernhard ' ));
83
+ return array (
84
+ array ('%!@$§ ' , 'Bernhard ' , (object ) array ('%!@$§ ' => 'Bernhard ' )),
85
+ array ('[0] ' , 'Bernhard ' , array ('Bernhard ' )),
86
+ array ('[%!@$§.] ' , 'Bernhard ' , array ('%!@$§. ' => 'Bernhard ' )),
90
87
91
- $ this ->assertEquals ('Bernhard ' , $ this ->getPropertyAccessor ()->getValue ($ array , '[root][%!@$§.] ' ));
92
- }
93
-
94
- public function testGetValueReadsArrayWithCustomPropertyPath ()
95
- {
96
- $ array = array ('child ' => array ('index ' => array ('firstName ' => 'Bernhard ' )));
88
+ array ('[root][%!@$§.] ' , 'Bernhard ' , array ('root ' => array ('%!@$§. ' => 'Bernhard ' ))),
89
+ array ('[child][index][firstName] ' , 'Bernhard ' , array ('child ' => array ('index ' => array ('firstName ' => 'Bernhard ' )))),
97
90
98
- $ this ->assertEquals ('Bernhard ' , $ this ->getPropertyAccessor ()->getValue ($ array , '[child][index][firstName] ' ));
91
+ // additional tests for #8930
92
+ array ('[@name] ' , 'Thunderer ' , array ('@name ' => 'Thunderer ' )),
93
+ array ('@name ' , 'Thunderer ' , (object ) array ('@name ' => 'Thunderer ' )),
94
+ array ('_name ' , 'Thunderer ' , (object ) array ('_name ' => 'Thunderer ' )),
95
+ );
99
96
}
100
97
101
98
public function testGetValueReadsArrayWithMissingIndexForCustomPropertyPath ()
0 commit comments