You are here

public function RequestTest::testDuplicate in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/Tests/RequestTest.php \Symfony\Component\HttpFoundation\Tests\RequestTest::testDuplicate()

File

vendor/symfony/http-foundation/Tests/RequestTest.php, line 280

Class

RequestTest

Namespace

Symfony\Component\HttpFoundation\Tests

Code

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');
}