Removing directories from cases.

Updating DispatcherTest

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@4444 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2007-02-04 07:57:43 +00:00
parent 1a391e4d2c
commit c4b6f522b2

View file

@ -39,12 +39,12 @@ class DispatcherTest extends UnitTestCase {
function testParseParamsWithoutZerosAndEmptyPost() {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/testcontroller/testaction/params1/params2/params3");
$this->assertIdentical($test['controller'], 'testcontroller', "<br />Parsed URL shows controller is {$test['controller']} expected testcontroller" );
$this->assertIdentical($test['action'], 'testaction', "<br />Parsed URL shows action is {$test['action']} expected testaction" );
$this->assertIdentical($test['pass'][0], 'params1', "<br />Parsed URL shows action is {$test['pass'][0]} expected params1" );
$this->assertIdentical($test['pass'][1], 'params2', "<br />Parsed URL shows action is {$test['pass'][1]} expected params2" );
$this->assertIdentical($test['pass'][2], 'params3', "<br />Parsed URL shows action is {$test['pass'][2]} expected params3" );
$this->assertFalse(!empty($test['form']), "<br />Parsed URL returning post data expected not post data");
$this->assertIdentical($test['controller'], 'testcontroller', "%s");
$this->assertIdentical($test['action'], 'testaction', "%s");
$this->assertIdentical($test['pass'][0], 'params1', "%s");
$this->assertIdentical($test['pass'][1], 'params2', "%s");
$this->assertIdentical($test['pass'][2], 'params3', "%s");
$this->assertFalse(!empty($test['form']), "%s");
}
function testParseParamsReturnsPostedData() {
@ -52,52 +52,50 @@ class DispatcherTest extends UnitTestCase {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/");
$this->assertTrue($test['form'], "Parsed URL not returning post data");
$this->assertIdentical($test['form']['testdata'],
"My Posted Content",
"'Post content is {$test['form']['testdata']} expected My Posted Content");
$this->assertIdentical($test['form']['testdata'], "My Posted Content", "%s");
}
function testParseParamsWithSingleZero() {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/testcontroller/testaction/1/0/23");
$this->assertIdentical($test['controller'], 'testcontroller', "<br />Parsed URL shows controller is {$test['controller']} expected testcontroller" );
$this->assertIdentical($test['action'], 'testaction', "<br />Parsed URL shows action is {$test['action']} expected testaction" );
$this->assertIdentical($test['pass'][0], '1', "value is {$test['pass'][0]} expected 1" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1], "value is {$test['pass'][1]} expected 0" );
$this->assertIdentical($test['pass'][2], '23', "value is {$test['pass'][2]} expected 23" );
$this->assertIdentical($test['controller'], 'testcontroller', "%s");
$this->assertIdentical($test['action'], 'testaction', "%s");
$this->assertIdentical($test['pass'][0], '1', "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1], "%s");
$this->assertIdentical($test['pass'][2], '23', "%s");
}
function testParseParamsWithManySingleZeros() {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/testcontroller/testaction/0/0/0/0/0/0");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0], "value is {$test['pass'][0]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1], "value is {$test['pass'][1]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][2], "value is {$test['pass'][2]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][3], "value is {$test['pass'][3]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][4], "value is {$test['pass'][4]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][5], "value is {$test['pass'][5]} expected 0" );
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][0], "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][1], "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][2], "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][3], "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][4], "%s");
$this->assertPattern('/\\A(?:0)\\z/', $test['pass'][5], "%s");
}
function testParseParamsWithManyZerosInEachSectionOfUrl() {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/testcontroller/testaction/000/0000/00000/000000/000000/0000000");
$this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0], "value is {$test['pass'][0]} expected 000" );
$this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1], "value is {$test['pass'][1]} expected 0000" );
$this->assertPattern('/\\A(?:00000)\\z/', $test['pass'][2], "value is {$test['pass'][2]} expected 00000" );
$this->assertPattern('/\\A(?:000000)\\z/', $test['pass'][3], "value is {$test['pass'][3]} expected 000000" );
$this->assertPattern('/\\A(?:000000)\\z/', $test['pass'][4], "value is {$test['pass'][4]} expected 000000" );
$this->assertPattern('/\\A(?:0000000)\\z/', $test['pass'][5], "value is {$test['pass'][5]} expected 0000000" );
$this->assertPattern('/\\A(?:000)\\z/', $test['pass'][0], "%s");
$this->assertPattern('/\\A(?:0000)\\z/', $test['pass'][1], "%s");
$this->assertPattern('/\\A(?:00000)\\z/', $test['pass'][2], "%s");
$this->assertPattern('/\\A(?:000000)\\z/', $test['pass'][3], "%s");
$this->assertPattern('/\\A(?:000000)\\z/', $test['pass'][4], "%s");
$this->assertPattern('/\\A(?:0000000)\\z/', $test['pass'][5], "%s");
}
function testParseParamsWithMixedOneToManyZerosInEachSectionOfUrl() {
$dispatcher =& new Dispatcher();
$test = $dispatcher->parseParams("/testcontroller/testaction/01/0403/04010/000002/000030/0000400");
$this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0], "value is {$test['pass'][0]} expected 01" );
$this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1], "value is {$test['pass'][1]} expected 0403" );
$this->assertPattern('/\\A(?:04010)\\z/', $test['pass'][2], "value is {$test['pass'][2]} expected 04010" );
$this->assertPattern('/\\A(?:000002)\\z/', $test['pass'][3], "value is {$test['pass'][3]} expected 000002" );
$this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4], "value is {$test['pass'][4]} expected 000030" );
$this->assertPattern('/\\A(?:0000400)\\z/', $test['pass'][5], "value is {$test['pass'][5]} expected 0000400" );
$this->assertPattern('/\\A(?:01)\\z/', $test['pass'][0], "%s");
$this->assertPattern('/\\A(?:0403)\\z/', $test['pass'][1], "%s");
$this->assertPattern('/\\A(?:04010)\\z/', $test['pass'][2], "%s");
$this->assertPattern('/\\A(?:000002)\\z/', $test['pass'][3], "%s");
$this->assertPattern('/\\A(?:000030)\\z/', $test['pass'][4], "%s");
$this->assertPattern('/\\A(?:0000400)\\z/', $test['pass'][5], "%s");
}
}
?>