@@ -32,18 +32,11 @@ class BodyListenerTest extends \PHPUnit_Framework_TestCase
3232 * @param array $expectedParameters the http parameters of the updated request
3333 * @param string $contentType the request header content type
3434 * @param boolean $throwExceptionOnUnsupportedContentType
35- * @param string $expectedRequestMethod
3635 *
3736 * @dataProvider testOnKernelRequestDataProvider
3837 */
39- public function testOnKernelRequest ($ decode , Request $ request , $ method , $ expectedParameters , $ contentType = null , $ throwExceptionOnUnsupportedContentType = false , $ expectedRequestMethod = null )
38+ public function testOnKernelRequest ($ decode , Request $ request , $ method , $ expectedParameters , $ contentType = null , $ throwExceptionOnUnsupportedContentType = false )
4039 {
41- if (!$ expectedRequestMethod ) {
42- $ expectedRequestMethod = $ method ;
43- } else {
44- $ request ->enableHttpMethodParameterOverride ();
45- }
46-
4740 $ decoder = $ this ->getMockBuilder ('FOS\RestBundle\Decoder\DecoderInterface ' )->disableOriginalConstructor ()->getMock ();
4841 $ decoder ->expects ($ this ->any ())
4942 ->method ('decode ' )
@@ -80,7 +73,6 @@ public function testOnKernelRequest($decode, Request $request, $method, $expecte
8073 $ listener ->onKernelRequest ($ event );
8174
8275 $ this ->assertEquals ($ request ->request ->all (), $ expectedParameters );
83- $ this ->assertEquals ($ request ->getMethod (), $ expectedRequestMethod );
8476 }
8577
8678 public static function testOnKernelRequestDataProvider ()
@@ -94,9 +86,6 @@ public static function testOnKernelRequestDataProvider()
9486 'POST request with parameters ' => array (false , new Request (array (), array ('bar ' ), array (), array (), array (), array (), array ('foo ' )), 'POST ' , array ('bar ' ), 'application/json ' ),
9587 'POST request with unallowed format ' => array (false , new Request (array (), array (), array (), array (), array (), array (), array ('foo ' )), 'POST ' , array (), 'application/fooformat ' ),
9688 'POST request with no Content-Type ' => array (true , new Request (array (), array (), array ('_format ' => 'json ' ), array (), array (), array (), array ('foo ' )), 'POST ' , array ('foo ' )),
97- 'POST request with _method parameter and disabled method-override ' => array (true , new Request (array (), array (), array ('_format ' => 'json ' ), array (), array (), array (), array ("_method " => "PUT " )), 'POST ' , array ('_method ' => 'PUT ' ), 'application/json ' ),
98- // This test is the last one, because you can't disable the http-method-override once it's enabled
99- 'POST request with _method parameter ' => array (true , new Request (array (), array (), array ('_format ' => 'json ' ), array (), array (), array (), array ("_method " => "PUT " )), 'POST ' , array ('_method ' => 'PUT ' ), 'application/json ' , false , "PUT " ),
10089 );
10190 }
10291
0 commit comments