From d60f1ae8960853385ad3f803bb3fcd3a5651c2c6 Mon Sep 17 00:00:00 2001 From: Giorgio Premi Date: Mon, 2 Mar 2015 12:45:23 +0100 Subject: [PATCH] Allow PUT and PATCH verbs for upload --- Routing/RouteLoader.php | 2 +- Tests/Controller/AbstractControllerTest.php | 8 +++++--- Tests/Routing/RouteLoaderTest.php | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Routing/RouteLoader.php b/Routing/RouteLoader.php index 4e8df119..cd8c070e 100644 --- a/Routing/RouteLoader.php +++ b/Routing/RouteLoader.php @@ -36,7 +36,7 @@ public function load($resource, $type = null) array(), '', array(), - array('POST') + array('POST', 'PUT', 'PATCH') ); if ($options['enable_progress'] === true) { diff --git a/Tests/Controller/AbstractControllerTest.php b/Tests/Controller/AbstractControllerTest.php index b5460ef4..2b0abf7e 100644 --- a/Tests/Controller/AbstractControllerTest.php +++ b/Tests/Controller/AbstractControllerTest.php @@ -51,14 +51,16 @@ public function testCallByDelete() $this->implTestCallBy('DELETE'); } + public function testCallByPatch() + { + $this->implTestCallBy('PATCH'); + } + public function testCallByPost() { $this->implTestCallBy('POST'); } - /** - * @expectedException Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException - */ public function testCallByPut() { $this->implTestCallBy('PUT'); diff --git a/Tests/Routing/RouteLoaderTest.php b/Tests/Routing/RouteLoaderTest.php index a09385e4..95b35ab0 100644 --- a/Tests/Routing/RouteLoaderTest.php +++ b/Tests/Routing/RouteLoaderTest.php @@ -34,7 +34,7 @@ public function testRouteLoader() foreach ($routes as $route) { $this->assertInstanceOf('Symfony\Component\Routing\Route', $route); $this->assertEquals('json', $route->getDefault('_format')); - $this->assertEquals(array('POST'), $route->getMethods()); + $this->assertContains('POST', $route->getMethods()); } } @@ -56,7 +56,7 @@ public function testPrefixedRoutes() foreach ($routes as $route) { $this->assertInstanceOf('Symfony\Component\Routing\Route', $route); $this->assertEquals('json', $route->getDefault('_format')); - $this->assertEquals(array('POST'), $route->getMethods()); + $this->assertContains('POST', $route->getMethods()); $this->assertEquals(0, strpos($route->getPath(), $prefix)); }