@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',
));
$dup = $request
->duplicate();
$this
->assertEquals($request->query
->all(), $dup->query
->all(), '->duplicate() duplicates a request an copy the current query parameters');
$this
->assertEquals($request->request
->all(), $dup->request
->all(), '->duplicate() duplicates a request an copy the current request parameters');
$this
->assertEquals($request->attributes
->all(), $dup->attributes
->all(), '->duplicate() duplicates a request an copy the current attributes');
$this
->assertEquals($request->headers
->all(), $dup->headers
->all(), '->duplicate() duplicates a request an copy the current HTTP headers');
$dup = $request
->duplicate(array(
'foo' => 'foobar',
), array(
'foo' => 'foobar',
), array(
'foo' => 'foobar',
), array(), array(), array(
'HTTP_FOO' => 'foobar',
));
$this
->assertEquals(array(
'foo' => 'foobar',
), $dup->query
->all(), '->duplicate() overrides the query parameters if provided');
$this
->assertEquals(array(
'foo' => 'foobar',
), $dup->request
->all(), '->duplicate() overrides the request parameters if provided');
$this
->assertEquals(array(
'foo' => 'foobar',
), $dup->attributes
->all(), '->duplicate() overrides the attributes if provided');
$this
->assertEquals(array(
'foo' => array(
'foobar',
),
), $dup->headers
->all(), '->duplicate() overrides the HTTP header if provided');
}