merged branch dlsniper/small-http-foundation-enhancement (PR #6999)
This PR was squashed before being merged into the 2.2 branch (closes #6999).
Commits
-------
de0f7b7
[HttpFoundation] Added getter for httpMethodParameterOverride state
Discussion
----------
[HttpFoundation] Added getter for httpMethodParameterOverride state
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #6984
| License | MIT
| Doc PR | ~
This commit is contained in:
commit
d0e964a1ae
@ -594,6 +594,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.
|
||||
*
|
||||
|
@ -712,7 +712,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