Skip to content

Commit

Permalink
Updating test case to use new Router constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed May 5, 2010
1 parent e9a7d6d commit b9a00cc
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions cake/tests/cases/libs/route/cake_route.test.php
Expand Up @@ -102,12 +102,10 @@ function testRouteParameterOverlap() {
* @return void
**/
function testRouteCompilingWithParamPatterns() {
extract(Router::getNamedExpressions());

$route = new CakeRoute(
'/:controller/:action/:id',
array(),
array('id' => $ID)
array('id' => Router::ID)
);
$result = $route->compile();
$this->assertPattern($result, '/posts/edit/1');
Expand All @@ -119,7 +117,7 @@ function testRouteCompilingWithParamPatterns() {
$route = new CakeRoute(
'/:lang/:controller/:action/:id',
array('controller' => 'testing4'),
array('id' => $ID, 'lang' => '[a-z]{3}')
array('id' => Router::ID, 'lang' => '[a-z]{3}')
);
$result = $route->compile();
$this->assertPattern($result, '/eng/posts/edit/1');
Expand All @@ -143,7 +141,7 @@ function testRouteCompilingWithParamPatterns() {
$route = new CakeRoute(
'/posts/:id::title/:year',
array('controller' => 'posts', 'action' => 'view'),
array('id' => $ID, 'year' => $Year, 'title' => '[a-z-_]+')
array('id' => Router::ID, 'year' => Router::YEAR, 'title' => '[a-z-_]+')
);
$result = $route->compile();
$this->assertPattern($result, '/posts/1:name-of-article/2009/');
Expand All @@ -156,7 +154,7 @@ function testRouteCompilingWithParamPatterns() {
$route = new CakeRoute(
'/posts/:url_title-(uuid::id)',
array('controller' => 'posts', 'action' => 'view'),
array('pass' => array('id', 'url_title'), 'id' => $ID)
array('pass' => array('id', 'url_title'), 'id' => Router::ID)
);
$result = $route->compile();
$this->assertPattern($result, '/posts/some_title_for_article-(uuid:12534)/');
Expand All @@ -174,12 +172,10 @@ function testRouteCompilingWithParamPatterns() {
* @return void
*/
function testComplexRouteCompilingAndParsing() {
extract(Router::getNamedExpressions());

$route = new CakeRoute(
'/posts/:month/:day/:year/*',
array('controller' => 'posts', 'action' => 'view'),
array('year' => $Year, 'month' => $Month, 'day' => $Day)
array('year' => Router::YEAR, 'month' => Router::MONTH, 'day' => Router::DAY)
);
$result = $route->compile();
$this->assertPattern($result, '/posts/08/01/2007/title-of-post');
Expand Down Expand Up @@ -383,8 +379,11 @@ function testPersistParams() {
* @return void
*/
function testParse() {
extract(Router::getNamedExpressions());
$route = new CakeRoute('/:controller/:action/:id', array('controller' => 'testing4', 'id' => null), array('id' => $ID));
$route = new CakeRoute(
'/:controller/:action/:id',
array('controller' => 'testing4', 'id' => null),
array('id' => Router::ID)
);
$route->compile();
$result = $route->parse('/posts/view/1');
$this->assertEqual($result['controller'], 'posts');
Expand Down

0 comments on commit b9a00cc

Please sign in to comment.