From 77185e09985dceb3a11f46546d0bb440e3418184 Mon Sep 17 00:00:00 2001 From: Victor Berchet Date: Tue, 10 Apr 2012 14:53:59 +0200 Subject: [PATCH] [Routing] Allow spaces in the script name for the apache dumper --- .../Routing/Fixtures/dumper/url_matcher2.apache | 7 +++++++ .../Routing/Matcher/Dumper/ApacheMatcherDumperTest.php | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.apache diff --git a/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.apache b/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.apache new file mode 100644 index 0000000000..d16ab974bf --- /dev/null +++ b/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher2.apache @@ -0,0 +1,7 @@ +# skip "real" requests +RewriteCond %{REQUEST_FILENAME} -f +RewriteRule .* - [QSA,L] + +# foo +RewriteCond %{REQUEST_URI} ^/foo$ +RewriteRule .* ap\ p_d\ ev.php [QSA,L,E=_ROUTING__route:foo] diff --git a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php index 97d78f9c77..537fcf3834 100644 --- a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php +++ b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/ApacheMatcherDumperTest.php @@ -34,7 +34,7 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase /** * @dataProvider provideEscapeFixtures */ - public function testEscape($src, $dest, $char, $with, $message) + public function testEscapePattern($src, $dest, $char, $with, $message) { $r = new \ReflectionMethod(new ApacheMatcherDumper($this->getRouteCollection()), 'escape'); $r->setAccessible(true); @@ -52,6 +52,14 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase ); } + public function testEscapeScriptName() + { + $collection = new RouteCollection(); + $collection->add('foo', new Route('/foo')); + $dumper = new ApacheMatcherDumper($collection); + $this->assertStringEqualsFile(self::$fixturesPath.'/dumper/url_matcher2.apache', $dumper->dump(array('script_name' => 'ap p_d\ ev.php'))); + } + private function getRouteCollection() { $collection = new RouteCollection();