Merge branch '2.2' into 2.3
* 2.2: [HttpFoundation] fixed format duplication in Request
This commit is contained in:
commit
7f0caff162
@ -404,9 +404,8 @@ class Request
|
||||
$dup->method = null;
|
||||
$dup->format = null;
|
||||
|
||||
if (!$dup->get('_format')) {
|
||||
// we set the request format to null if the current request is not known
|
||||
$dup->setRequestFormat($this->getRequestFormat(null));
|
||||
if (!$dup->get('_format') && $this->get('_format')) {
|
||||
$dup->attributes->set('_format', $this->get('_format'));
|
||||
}
|
||||
|
||||
return $dup;
|
||||
|
@ -250,9 +250,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('foo=bar', $request->getQueryString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\HttpFoundation\Request::duplicate
|
||||
*/
|
||||
public function testDuplicate()
|
||||
{
|
||||
$request = new Request(array('foo' => 'bar'), array('foo' => 'bar'), array('foo' => 'bar'), array(), array(), array('HTTP_FOO' => 'bar'));
|
||||
@ -271,6 +268,15 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(array('foo' => array('foobar')), $dup->headers->all(), '->duplicate() overrides the HTTP header if provided');
|
||||
}
|
||||
|
||||
public function testDuplicateWithFormat()
|
||||
{
|
||||
$request = new Request(array(), array(), array('_format' => 'json'));
|
||||
$dup = $request->duplicate();
|
||||
|
||||
$this->assertEquals('json', $dup->getRequestFormat());
|
||||
$this->assertEquals('json', $dup->attributes->get('_format'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Symfony\Component\HttpFoundation\Request::getFormat
|
||||
* @covers Symfony\Component\HttpFoundation\Request::setFormat
|
||||
|
Reference in New Issue
Block a user