Skip to content

Commit

Permalink
[HttpFoundation] fixed some unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed Sep 10, 2013
1 parent e7386a8 commit 6ec2cba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Symfony/Component/HttpFoundation/Request.php
Expand Up @@ -410,6 +410,10 @@ public function duplicate(array $query = null, array $request = null, array $att
$dup->attributes->set('_format', $this->get('_format'));
}

if (!$dup->getRequestFormat(null)) {
$dup->setRequestFormat($format = $this->getRequestFormat(null));
}

return $dup;
}

Expand Down
6 changes: 6 additions & 0 deletions src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
Expand Up @@ -284,6 +284,12 @@ public function testDuplicateWithFormat()

$this->assertEquals('json', $dup->getRequestFormat());
$this->assertEquals('json', $dup->attributes->get('_format'));

$request = new Request();
$request->setRequestFormat('xml');
$dup = $request->duplicate();

$this->assertEquals('xml', $dup->getRequestFormat());
}

/**
Expand Down

0 comments on commit 6ec2cba

Please sign in to comment.