From f0f1531faca68553012fd2ffe9153e0c7af76a79 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 24 Aug 2014 12:12:52 +0200 Subject: [PATCH] Add test for #4309 The Router internals don't handle // which is good. --- lib/Cake/Test/Case/Routing/RouterTest.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/Cake/Test/Case/Routing/RouterTest.php b/lib/Cake/Test/Case/Routing/RouterTest.php index d1a466980..0a78cdedc 100644 --- a/lib/Cake/Test/Case/Routing/RouterTest.php +++ b/lib/Cake/Test/Case/Routing/RouterTest.php @@ -996,6 +996,23 @@ class RouterTest extends CakeTestCase { $this->assertEquals('/admin/other/posts/index', $result); } +/** + * Test that URL's fail to parse when they are prefixed with // + * + * @return void + */ + public function testUrlParseFailureDoubleSlash() { + Router::connect('/posts', array('controller' => 'posts', 'action' => 'index')); + $result = Router::parse('/posts'); + $this->assertEquals( + array('pass' => array(), 'named' => array(), 'plugin' => null, 'controller' => 'posts', 'action' => 'index'), + $result + ); + + $result = Router::parse('//posts'); + $this->assertEquals(array(), $result); + } + /** * testUrlParsing method *