Exemple #1
0
 /**
  * When the controller returns string, we create a response that has a body of the string.
  */
 public function testAutoResponse()
 {
     $r = new Router();
     $r->delete('/basic', function () {
         return 'mOmonga';
     });
     $req = Request::create('/basic', 'DELETE');
     $res = $r->run($req);
     $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\Response', $res);
     $this->assertEquals(200, $res->getStatusCode());
     $this->assertEquals('mOmonga', $res->getContent());
     // $r = new Router();
     // $r->delete('/basic', function () { return 404; });
     // $req = Request::create('/basic', 'DELETE');
     // $res = $r->run($req);
     // $this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $res);
     // $this->assertEquals(404, $res->getStatusCode());
 }