@@ -68,6 +68,7 @@ public function testBasicRouteCompiling() {
68
68
$ this ->assertRegExp ($ result , '/posts/super_delete ' );
69
69
$ this ->assertNotRegExp ($ result , '/posts ' );
70
70
$ this ->assertNotRegExp ($ result , '/posts/super_delete/1 ' );
71
+ $ this ->assertSame ($ result , $ route ->compile ());
71
72
72
73
$ route = new Route ('/posts/foo:id ' , array ('controller ' => 'posts ' , 'action ' => 'view ' ));
73
74
$ result = $ route ->compile ();
@@ -934,4 +935,23 @@ public function testUTF8PatternOnSection() {
934
935
$ this ->assertEquals ($ expected , $ result );
935
936
}
936
937
938
+ /**
939
+ * Test getting the static path for a route.
940
+ *
941
+ * @return void
942
+ */
943
+ public function testStaticPath () {
944
+ $ route = new Route ('/pages/* ' , ['controller ' => 'Pages ' , 'action ' => 'display ' ]);
945
+ $ this ->assertEquals ('/pages/ ' , $ route ->staticPath ());
946
+
947
+ $ route = new Route ('/pages/:id/* ' , ['controller ' => 'Pages ' , 'action ' => 'display ' ]);
948
+ $ this ->assertEquals ('/pages/ ' , $ route ->staticPath ());
949
+
950
+ $ route = new Route ('/:controller/:action/* ' );
951
+ $ this ->assertEquals ('/ ' , $ route ->staticPath ());
952
+
953
+ $ route = new Route ('/books/reviews ' , ['controller ' => 'Reviews ' , 'action ' => 'index ' ]);
954
+ $ this ->assertEquals ('/books/reviews ' , $ route ->staticPath ());
955
+ }
956
+
937
957
}
0 commit comments