Skip to content
Permalink
Browse files

Add tests for Route::staticPath().

  • Loading branch information...
markstory committed Jul 6, 2014
1 parent 12c5f5b commit ae6589874d99289f7a22c90b131fc69305344ace
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/TestCase/Routing/Route/RouteTest.php
@@ -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();
@@ -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.
You can’t perform that action at this time.