@@ -202,6 +202,12 @@ public function testGetMethod()
202
202
203
203
$ form = $ this ->createForm ('<form method="post"><input type="submit" /></form> ' , 'put ' );
204
204
$ this ->assertEquals ('PUT ' , $ form ->getMethod (), '->getMethod() returns the method defined in the constructor if provided ' );
205
+
206
+ $ form = $ this ->createForm ('<form method="post"><input type="submit" /></form> ' , 'delete ' );
207
+ $ this ->assertEquals ('DELETE ' , $ form ->getMethod (), '->getMethod() returns the method defined in the constructor if provided ' );
208
+
209
+ $ form = $ this ->createForm ('<form method="post"><input type="submit" /></form> ' , 'patch ' );
210
+ $ this ->assertEquals ('PATCH ' , $ form ->getMethod (), '->getMethod() returns the method defined in the constructor if provided ' );
205
211
}
206
212
207
213
public function testGetSetValue ()
@@ -278,7 +284,16 @@ public function testGetFiles()
278
284
$ this ->assertEquals (array (), $ form ->getFiles (), '->getFiles() returns an empty array if method is get ' );
279
285
280
286
$ form = $ this ->createForm ('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form> ' );
281
- $ this ->assertEquals (array ('foo[bar] ' => array ('name ' => '' , 'type ' => '' , 'tmp_name ' => '' , 'error ' => 4 , 'size ' => 0 )), $ form ->getFiles (), '->getFiles() only returns file fields ' );
287
+ $ this ->assertEquals (array ('foo[bar] ' => array ('name ' => '' , 'type ' => '' , 'tmp_name ' => '' , 'error ' => 4 , 'size ' => 0 )), $ form ->getFiles (), '->getFiles() only returns file fields for POST ' );
288
+
289
+ $ form = $ this ->createForm ('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form> ' , 'put ' );
290
+ $ this ->assertEquals (array ('foo[bar] ' => array ('name ' => '' , 'type ' => '' , 'tmp_name ' => '' , 'error ' => 4 , 'size ' => 0 )), $ form ->getFiles (), '->getFiles() only returns file fields for PUT ' );
291
+
292
+ $ form = $ this ->createForm ('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form> ' , 'delete ' );
293
+ $ this ->assertEquals (array ('foo[bar] ' => array ('name ' => '' , 'type ' => '' , 'tmp_name ' => '' , 'error ' => 4 , 'size ' => 0 )), $ form ->getFiles (), '->getFiles() only returns file fields for DELETE ' );
294
+
295
+ $ form = $ this ->createForm ('<form method="post"><input type="file" name="foo[bar]" /><input type="text" name="bar" value="bar" /><input type="submit" /></form> ' , 'patch ' );
296
+ $ this ->assertEquals (array ('foo[bar] ' => array ('name ' => '' , 'type ' => '' , 'tmp_name ' => '' , 'error ' => 4 , 'size ' => 0 )), $ form ->getFiles (), '->getFiles() only returns file fields for PATCH ' );
282
297
283
298
$ form = $ this ->createForm ('<form method="post"><input type="file" name="foo[bar]" disabled="disabled" /><input type="submit" /></form> ' );
284
299
$ this ->assertEquals (array (), $ form ->getFiles (), '->getFiles() does not include disabled file fields ' );
@@ -293,9 +308,9 @@ public function testGetPhpFiles()
293
308
/**
294
309
* @dataProvider provideGetUriValues
295
310
*/
296
- public function testGetUri ($ message , $ form , $ values , $ uri )
311
+ public function testGetUri ($ message , $ form , $ values , $ uri, $ method = null )
297
312
{
298
- $ form = $ this ->createForm ($ form );
313
+ $ form = $ this ->createForm ($ form, $ method );
299
314
$ form ->setValues ($ values );
300
315
301
316
$ this ->assertEquals ('http://example.com ' .$ uri , $ form ->getUri (), '->getUri() ' .$ message );
@@ -387,6 +402,27 @@ public function provideGetUriValues()
387
402
array (),
388
403
'/foo '
389
404
),
405
+ array (
406
+ 'does not append values if the method is patch ' ,
407
+ '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form> ' ,
408
+ array (),
409
+ '/foo ' ,
410
+ 'PUT '
411
+ ),
412
+ array (
413
+ 'does not append values if the method is delete ' ,
414
+ '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form> ' ,
415
+ array (),
416
+ '/foo ' ,
417
+ 'DELETE '
418
+ ),
419
+ array (
420
+ 'does not append values if the method is put ' ,
421
+ '<form action="/foo" method="post"><input type="text" name="foo" value="foo" /><input type="submit" /></form> ' ,
422
+ array (),
423
+ '/foo ' ,
424
+ 'PATCH '
425
+ ),
390
426
array (
391
427
'appends the form values to an existing query string ' ,
392
428
'<form action="/foo?bar=bar"><input type="text" name="foo" value="foo" /><input type="submit" /></form> ' ,
0 commit comments