Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / routing / Tests / Matcher / UrlMatcherTest.php
index 6d59855d2d8f39c6f236a93c3b698eefcf109d7c..1eeb5d4360cdee54a856b8c07d361c3b20d14e1e 100644 (file)
@@ -166,7 +166,7 @@ class UrlMatcherTest extends TestCase
     {
         $collection = new RouteCollection();
         $chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-';
-        $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+')));
+        $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+'), array('utf8' => true)));
 
         $matcher = new UrlMatcher($collection, new RequestContext());
         $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.rawurlencode($chars).'/bar'));
@@ -337,6 +337,16 @@ class UrlMatcherTest extends TestCase
         $matcher->match('/foo');
     }
 
+    public function testRequestCondition()
+    {
+        $coll = new RouteCollection();
+        $route = new Route('/foo/{bar}');
+        $route->setCondition('request.getBaseUrl() == "/sub/front.php" and request.getPathInfo() == "/foo/bar"');
+        $coll->add('foo', $route);
+        $matcher = new UrlMatcher($coll, new RequestContext('/sub/front.php'));
+        $this->assertEquals(array('bar' => 'bar', '_route' => 'foo'), $matcher->match('/foo/bar'));
+    }
+
     public function testDecodeOnce()
     {
         $coll = new RouteCollection();