summaryrefslogtreecommitdiffstats
path: root/Tests/Http/HttpUtilsTest.php
diff options
context:
space:
mode:
authorJean-François Simon <contact@jfsimon.fr>2013-03-11 06:59:49 +0100
committerFabien Potencier <fabien.potencier@gmail.com>2013-03-13 18:34:15 +0100
commit339f14cab6ffc0a4285f480a7487b32e3d4c20c1 (patch)
tree9dc4d7414f1a9cd7e8f5f216e6e6158889431075 /Tests/Http/HttpUtilsTest.php
parent32b46da27a08ebf51e2d8ea1aa82e39c56c0bcfe (diff)
downloadsymfony-security-339f14cab6ffc0a4285f480a7487b32e3d4c20c1.zip
symfony-security-339f14cab6ffc0a4285f480a7487b32e3d4c20c1.tar.gz
symfony-security-339f14cab6ffc0a4285f480a7487b32e3d4c20c1.tar.bz2
[Security] use current request attributes to generate redirect url?
Diffstat (limited to 'Tests/Http/HttpUtilsTest.php')
-rw-r--r--Tests/Http/HttpUtilsTest.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/Tests/Http/HttpUtilsTest.php b/Tests/Http/HttpUtilsTest.php
index fc1b754..8a2d2f0 100644
--- a/Tests/Http/HttpUtilsTest.php
+++ b/Tests/Http/HttpUtilsTest.php
@@ -137,13 +137,25 @@ class HttpUtilsTest extends \PHPUnit_Framework_TestCase
$utils->checkRequestPath($this->getRequest(), 'foobar');
}
- private function getUrlGenerator()
+ public function testGenerateUrlRemovesQueryString()
+ {
+ $method = new \ReflectionMethod('Symfony\Component\Security\Http\HttpUtils', 'generateUrl');
+ $method->setAccessible(true);
+
+ $utils = new HttpUtils($this->getUrlGenerator());
+ $this->assertEquals('/foo/bar', $method->invoke($utils, 'route_name'));
+
+ $utils = new HttpUtils($this->getUrlGenerator('/foo/bar?param=value'));
+ $this->assertEquals('/foo/bar', $method->invoke($utils, 'route_name'));
+ }
+
+ private function getUrlGenerator($generatedUrl = '/foo/bar')
{
$urlGenerator = $this->getMock('Symfony\Component\Routing\Generator\UrlGeneratorInterface');
$urlGenerator
->expects($this->any())
->method('generate')
- ->will($this->returnValue('/foo/bar'))
+ ->will($this->returnValue($generatedUrl))
;
return $urlGenerator;