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
This commit is contained in:
mark_story 2008-05-17 03:52:08 +00:00
parent 638b06ff85
commit 926b88a53a

View file

@ -255,6 +255,30 @@ class DispatcherTest extends UnitTestCase {
$this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4]); $this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4]);
$this->assertPattern('/\\A(?:0000400)\\z/', $test['pass'][5]); $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() { function testFileUploadArrayStructure() {
$_FILES = array('data' => array('name' => array( $_FILES = array('data' => array('name' => array(
@ -380,6 +404,7 @@ class DispatcherTest extends UnitTestCase {
$result = $Dispatcher->getUrl($uri); $result = $Dispatcher->getUrl($uri);
$expected = '?/home'; $expected = '?/home';
$this->assertEqual($expected, $result); $this->assertEqual($expected, $result);
} }
function testBaseUrlAndWebrootWithModRewrite() { function testBaseUrlAndWebrootWithModRewrite() {
@ -874,13 +899,15 @@ class DispatcherTest extends UnitTestCase {
$Dispatcher->cached('css/test_asset.css'); $Dispatcher->cached('css/test_asset.css');
$result = ob_get_clean(); $result = ob_get_clean();
$this->assertEqual('this is the test asset css file', $result); $this->assertEqual('this is the test asset css file', $result);
Configure::write('debug', 0); Configure::write('debug', 0);
$Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css'); $Dispatcher->params = $Dispatcher->parseParams('test_plugin/css/test_plugin_asset.css');
ob_start(); ob_start();
$Dispatcher->cached('test_plugin/css/test_plugin_asset.css'); $Dispatcher->cached('test_plugin/css/test_plugin_asset.css');
$result = ob_get_clean(); $result = ob_get_clean();
$this->assertEqual('this is the test plugin asset css file', $result); $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() { function testFullPageCachingDispatch() {