From 926b88a53a8a2af0403ea8eeec910da20c8b7ed7 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 17 May 2008 03:52:08 +0000 Subject: [PATCH] Updated dispatcher test for case described in #4660 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6906 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/tests/cases/dispatcher.test.php | 29 +++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/cake/tests/cases/dispatcher.test.php b/cake/tests/cases/dispatcher.test.php index a2d7bac34..7bfc7ec47 100644 --- a/cake/tests/cases/dispatcher.test.php +++ b/cake/tests/cases/dispatcher.test.php @@ -255,6 +255,30 @@ class DispatcherTest extends UnitTestCase { $this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4]); $this->assertPattern('/\\A(?:0000400)\\z/', $test['pass'][5]); } + + function testQueryStringOnRoot() { + $_GET = array('coffee' => 'life', + 'sleep' => 'sissies'); + $Dispatcher =& new Dispatcher(); + $uri = 'posts/home/?coffee=life&sleep=sissies'; + $result = $Dispatcher->parseParams($uri); + $this->assertPattern('/posts/',$result['controller']); + $this->assertPattern('/home/',$result['action']); + $this->assertTrue(isset($result['url']['sleep'])); + $this->assertTrue(isset($result['url']['coffee'])); + + + $Dispatcher =& new Dispatcher(); + $uri = '/?coffee=life&sleep=sissy'; + $result = $Dispatcher->parseParams($uri); + $this->assertPattern('/pages/',$result['controller']); + $this->assertPattern('/display/',$result['action']); + $this->assertTrue(isset($result['url']['sleep'])); + $this->assertTrue(isset($result['url']['coffee'])); + $this->assertEqual($result['url']['coffee'], 'life'); + + $_GET = $this->_get; + } function testFileUploadArrayStructure() { $_FILES = array('data' => array('name' => array( @@ -380,6 +404,7 @@ class DispatcherTest extends UnitTestCase { $result = $Dispatcher->getUrl($uri); $expected = '?/home'; $this->assertEqual($expected, $result); + } function testBaseUrlAndWebrootWithModRewrite() { @@ -874,13 +899,15 @@ class DispatcherTest extends UnitTestCase { $Dispatcher->cached('css/test_asset.css'); $result = ob_get_clean(); $this->assertEqual('this is the test asset css file', $result); - + Configure::write('debug', 0); $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css'); ob_start(); $Dispatcher->cached('test_plugin/css/test_plugin_asset.css'); $result = ob_get_clean(); $this->assertEqual('this is the test plugin asset css file', $result); + + header('Content-type: text/html'); //reset the header content-type without page can render as plain text. } function testFullPageCachingDispatch() {