From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../Routing/Tests/Matcher/ApacheUrlMatcherTest.php | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php (limited to 'vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php') diff --git a/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php new file mode 100644 index 00000000..6550911e --- /dev/null +++ b/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -0,0 +1,137 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Routing\Tests\Matcher; + +use Symfony\Component\Routing\RouteCollection; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\Matcher\ApacheUrlMatcher; + +class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase +{ + protected $server; + + protected function setUp() + { + $this->server = $_SERVER; + } + + protected function tearDown() + { + $_SERVER = $this->server; + } + + /** + * @dataProvider getMatchData + */ + public function testMatch($name, $pathinfo, $server, $expect) + { + $collection = new RouteCollection(); + $context = new RequestContext(); + $matcher = new ApacheUrlMatcher($collection, $context); + + $_SERVER = $server; + + $result = $matcher->match($pathinfo, $server); + $this->assertSame(var_export($expect, true), var_export($result, true)); + } + + public function getMatchData() + { + return array( + array( + 'Simple route', + '/hello/world', + array( + '_ROUTING_route' => 'hello', + '_ROUTING_param__controller' => 'AcmeBundle:Default:index', + '_ROUTING_param_name' => 'world', + ), + array( + '_controller' => 'AcmeBundle:Default:index', + 'name' => 'world', + '_route' => 'hello', + ), + ), + array( + 'Route with params and defaults', + '/hello/hugo', + array( + '_ROUTING_route' => 'hello', + '_ROUTING_param__controller' => 'AcmeBundle:Default:index', + '_ROUTING_param_name' => 'hugo', + '_ROUTING_default_name' => 'world', + ), + array( + 'name' => 'hugo', + '_controller' => 'AcmeBundle:Default:index', + '_route' => 'hello', + ), + ), + array( + 'Route with defaults only', + '/hello', + array( + '_ROUTING_route' => 'hello', + '_ROUTING_param__controller' => 'AcmeBundle:Default:index', + '_ROUTING_default_name' => 'world', + ), + array( + 'name' => 'world', + '_controller' => 'AcmeBundle:Default:index', + '_route' => 'hello', + ), + ), + array( + 'REDIRECT_ envs', + '/hello/world', + array( + 'REDIRECT__ROUTING_route' => 'hello', + 'REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', + 'REDIRECT__ROUTING_param_name' => 'world', + ), + array( + '_controller' => 'AcmeBundle:Default:index', + 'name' => 'world', + '_route' => 'hello', + ), + ), + array( + 'REDIRECT_REDIRECT_ envs', + '/hello/world', + array( + 'REDIRECT_REDIRECT__ROUTING_route' => 'hello', + 'REDIRECT_REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', + 'REDIRECT_REDIRECT__ROUTING_param_name' => 'world', + ), + array( + '_controller' => 'AcmeBundle:Default:index', + 'name' => 'world', + '_route' => 'hello', + ), + ), + array( + 'REDIRECT_REDIRECT_ envs', + '/hello/world', + array( + 'REDIRECT_REDIRECT__ROUTING_route' => 'hello', + 'REDIRECT_REDIRECT__ROUTING_param__controller' => 'AcmeBundle:Default:index', + 'REDIRECT_REDIRECT__ROUTING_param_name' => 'world', + ), + array( + '_controller' => 'AcmeBundle:Default:index', + 'name' => 'world', + '_route' => 'hello', + ), + ), + ); + } +} -- cgit v1.2.3