diff --git a/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php b/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php index 303fbdfb09..8b3088f8a3 100644 --- a/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php +++ b/tests/Symfony/Tests/Component/Routing/Fixtures/dumper/url_matcher1.php @@ -37,6 +37,20 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz2')); } + if (rtrim($url, '/') === '/test/baz3') { + if (substr($url, -1) !== '/') { + return array('_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', 'url' => $this->context['base_url'].$url.'/', 'permanent' => true, '_route' => 'baz3'); + } + return array_merge($this->mergeDefaults(array(), array ()), array('_route' => 'baz3')); + } + + if (0 === strpos($url, '/test') && preg_match('#^/test/(?P[^/\.]+?)/?$#x', $url, $matches)) { + if (substr($url, -1) !== '/') { + return array('_controller' => 'Symfony\Bundle\FrameworkBundle\Controller\RedirectController::urlRedirectAction', 'url' => $this->context['base_url'].$url.'/', 'permanent' => true, '_route' => 'baz4'); + } + return array_merge($this->mergeDefaults($matches, array ()), array('_route' => 'baz4')); + } + return false; } } diff --git a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/PhpMatcherDumperTest.php b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/PhpMatcherDumperTest.php index 5b05c8caad..aa90a25455 100644 --- a/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/tests/Symfony/Tests/Component/Routing/Matcher/Dumper/PhpMatcherDumperTest.php @@ -44,6 +44,12 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase $collection->add('baz2', new Route( '/test/baz.html' )); + $collection->add('baz3', new Route( + '/test/baz3/' + )); + $collection->add('baz4', new Route( + '/test/{foo}/' + )); $dumper = new PhpMatcherDumper($collection); $this->assertStringEqualsFile(self::$fixturesPath.'/dumper/url_matcher1.php', $dumper->dump(), '->dump() dumps basic routes to the correct PHP file.');