@@ -41,6 +41,7 @@ public function testGetProperties()
41
41
'B ' ,
42
42
'Guid ' ,
43
43
'g ' ,
44
+ 'emptyVar ' ,
44
45
'foo ' ,
45
46
'foo2 ' ,
46
47
'foo3 ' ,
@@ -172,37 +173,63 @@ public function php71TypesProvider()
172
173
);
173
174
}
174
175
175
- public function testIsReadable ()
176
+ /**
177
+ * @dataProvider getReadableProperties
178
+ */
179
+ public function testIsReadable ($ property , $ expected )
180
+ {
181
+ $ this ->assertSame (
182
+ $ expected ,
183
+ $ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , $ property , array ())
184
+ );
185
+ }
186
+
187
+ public function getReadableProperties ()
188
+ {
189
+ return array (
190
+ array ('bar ' , false ),
191
+ array ('baz ' , false ),
192
+ array ('parent ' , true ),
193
+ array ('a ' , true ),
194
+ array ('b ' , false ),
195
+ array ('c ' , true ),
196
+ array ('d ' , true ),
197
+ array ('e ' , false ),
198
+ array ('f ' , false ),
199
+ array ('Id ' , true ),
200
+ array ('id ' , true ),
201
+ array ('Guid ' , true ),
202
+ array ('guid ' , false ),
203
+ );
204
+ }
205
+
206
+ /**
207
+ * @dataProvider getWritableProperties
208
+ */
209
+ public function testIsWritable ($ property , $ expected )
176
210
{
177
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'bar ' , array ()));
178
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'baz ' , array ()));
179
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'parent ' , array ()));
180
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'a ' , array ()));
181
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'b ' , array ()));
182
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'c ' , array ()));
183
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'd ' , array ()));
184
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'e ' , array ()));
185
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'f ' , array ()));
186
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'Id ' , array ()));
187
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'id ' , array ()));
188
- $ this ->assertTrue ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'Guid ' , array ()));
189
- $ this ->assertFalse ($ this ->extractor ->isReadable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'guid ' , array ()));
211
+ $ this ->assertSame (
212
+ $ expected ,
213
+ $ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , $ property , array ())
214
+ );
190
215
}
191
216
192
- public function testIsWritable ()
217
+ public function getWritableProperties ()
193
218
{
194
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'bar ' , array ()));
195
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'baz ' , array ()));
196
- $ this ->assertTrue ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'parent ' , array ()));
197
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'a ' , array ()));
198
- $ this ->assertTrue ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'b ' , array ()));
199
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'c ' , array ()));
200
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'd ' , array ()));
201
- $ this ->assertTrue ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'e ' , array ()));
202
- $ this ->assertTrue ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'f ' , array ()));
203
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'Id ' , array ()));
204
- $ this ->assertTrue ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'Guid ' , array ()));
205
- $ this ->assertFalse ($ this ->extractor ->isWritable ('Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy ' , 'guid ' , array ()));
219
+ return array (
220
+ array ('bar ' , false ),
221
+ array ('baz ' , false ),
222
+ array ('parent ' , true ),
223
+ array ('a ' , false ),
224
+ array ('b ' , true ),
225
+ array ('c ' , false ),
226
+ array ('d ' , false ),
227
+ array ('e ' , true ),
228
+ array ('f ' , true ),
229
+ array ('Id ' , false ),
230
+ array ('Guid ' , true ),
231
+ array ('guid ' , false ),
232
+ );
206
233
}
207
234
208
235
public function testSingularize ()
0 commit comments