Skip to content

Commit

Permalink
[HttpFoundation] Added getter for httpMethodParameterOverride state
Browse files Browse the repository at this point in the history
  • Loading branch information
dlsniper authored and fabpot committed Feb 15, 2013
1 parent 60cf0aa commit de0f7b7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -591,6 +591,16 @@ public static function enableHttpMethodParameterOverride()
self::$httpMethodParameterOverride = true;
}

/**
* Get the state of httpMethodParameterOverride value.
*
* @return Boolean
*/
public static function getHttpMethodParameterOverride()
{
return self::$httpMethodParameterOverride;
}

/**
* Gets a "parameter" value.
*
Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -677,7 +677,13 @@ public function testGetSetMethod()
$request = new Request();
$request->setMethod('POST');
$request->request->set('_method', 'purge');

$this->assertFalse(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be disabled by default');

Request::enableHttpMethodParameterOverride();

$this->assertTrue(Request::getHttpMethodParameterOverride(), 'httpMethodParameterOverride should be enabled now but it is not');

$this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST');
$this->disableHttpMethodParameterOverride();

Expand Down

0 comments on commit de0f7b7

Please sign in to comment.