コード例 #1
0
ファイル: RouteTest.php プロジェクト: collectivism/router
 public function testRoutes()
 {
     // Register routes
     Route::get('/foo/bar', __DIR__ . '/foo/bar.php');
     Route::get('/foo/baz', __DIR__ . '/foo/baz.php');
     $this->assertEquals(Route::routes(), array('\\/foo\\/bar' => array('method' => 'GET', 'file' => __DIR__ . '/foo/bar.php'), '\\/foo\\/baz' => array('method' => 'GET', 'file' => __DIR__ . '/foo/baz.php')));
 }
コード例 #2
0
ファイル: RouterTest.php プロジェクト: collectivism/router
 public function testRouterNoMatchFound()
 {
     // Register routes
     Route::get('/foo/bar', __DIR__ . '/foo/bar.php');
     Route::get('/foo/baz', __DIR__ . '/foo/baz.php');
     // Fake a request by setting $_SERVER
     $_SERVER['REQUEST_METHOD'] = 'GET';
     $_SERVER['PATH_INFO'] = 'http://foo.bar.com/foo/baz';
     try {
         Router::start();
     } catch (\Exception $e) {
         $message = $e->getMessage();
     }
     $this->assertEquals($message, 'file does not exist');
 }