Permalink
Browse files

Adding a test case for RouterRoute to increase code coverage.

  • Loading branch information...
1 parent 3885466 commit 0b9ae92eb9f216c865550392635d5cd1270f6927 @markstory markstory committed Nov 26, 2009
Showing with 9 additions and 1 deletion.
  1. +9 −1 cake/tests/cases/libs/router.test.php
@@ -2091,6 +2091,15 @@ function testRouteCompilingWithParamPatterns() {
$result = $route->compile();
$this->assertEqual($result, '#^/posts(?:/([0-9]+))(?:\\:([a-z-_]+))(?:/([12][0-9]{3}))[\/]*$#');
$this->assertEqual($route->keys, array('id', 'title', 'year'));
+
+ $route =& new RouterRoute(
+ '/posts/:url_title-(uuid::id)',
+ array('controller' => 'posts', 'action' => 'view'),
+ array('pass' => array('id', 'url_title'), 'id' => $ID)
+ );
+ $result = $route->compile();
+ $this->assertEqual($result, '#^/posts(?:/([^\/]+))?(?:-\(uuid\:([0-9]+)\))[\/]*$#');
+ $this->assertEqual($route->keys, array('url_title', 'id'));
}
/**
@@ -2112,7 +2121,6 @@ function testMatching() {
$expected = '/admin/subscriptions/edit/1/';
$this->assertEqual($result, $expected);
}
-
}

0 comments on commit 0b9ae92

Please sign in to comment.