Ejemplo n.º 1
0
 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')));
 }
Ejemplo n.º 2
0
 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');
 }