[HttpFoundation] Added getter for httpMethodParameterOverride state
This commit is contained in:
parent
60cf0aa181
commit
de0f7b759f
@ -591,6 +591,16 @@ class Request
|
||||
self::$httpMethodParameterOverride = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of httpMethodParameterOverride value.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public static function getHttpMethodParameterOverride()
|
||||
{
|
||||
return self::$httpMethodParameterOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a "parameter" value.
|
||||
*
|
||||
|
@ -677,7 +677,13 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$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();
|
||||
|
||||
|
Reference in New Issue
Block a user