Skip to content

Commit

Permalink
Add tests for Route::staticPath().
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 7, 2014
1 parent 12c5f5b commit ae65898
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/TestCase/Routing/Route/RouteTest.php
Expand Up @@ -68,6 +68,7 @@ public function testBasicRouteCompiling() {
$this->assertRegExp($result, '/posts/super_delete');
$this->assertNotRegExp($result, '/posts');
$this->assertNotRegExp($result, '/posts/super_delete/1');
$this->assertSame($result, $route->compile());

$route = new Route('/posts/foo:id', array('controller' => 'posts', 'action' => 'view'));
$result = $route->compile();
Expand Down Expand Up @@ -934,4 +935,23 @@ public function testUTF8PatternOnSection() {
$this->assertEquals($expected, $result);
}

/**
* Test getting the static path for a route.
*
* @return void
*/
public function testStaticPath() {
$route = new Route('/pages/*', ['controller' => 'Pages', 'action' => 'display']);
$this->assertEquals('/pages/', $route->staticPath());

$route = new Route('/pages/:id/*', ['controller' => 'Pages', 'action' => 'display']);
$this->assertEquals('/pages/', $route->staticPath());

$route = new Route('/:controller/:action/*');
$this->assertEquals('/', $route->staticPath());

$route = new Route('/books/reviews', ['controller' => 'Reviews', 'action' => 'index']);
$this->assertEquals('/books/reviews', $route->staticPath());
}

}

0 comments on commit ae65898

Please sign in to comment.