Example #1
0
 public function testIntegerParam()
 {
     $app = new Application();
     $app->handlers([new RouterMiddleware($app)]);
     $app->route('/blog/{id:[0-9]+}', function () {
         $this->response($this->params('id'));
     });
     $response = $app->handle(Request::create('/blog/12345'));
     $this->assertSame('12345', $response->getContent());
     $this->assertSame(200, $response->getStatusCode());
 }
Example #2
0
 public function testRoute()
 {
     $app = new Application();
     $route = $app->route('/');
     $this->assertInstanceOf('Durian\\Route', $route);
     $route = $app->route('/', function () {
     });
     $this->assertInstanceOf('Durian\\Route', $route);
     $route = $app->route('/', function () {
     }, function () {
     });
     $this->assertInstanceOf('Durian\\Route', $route);
 }