Example #1
0
 /**
  * Test creating error responses.
  *
  * @return void
  */
 public function testErrorResponse()
 {
     // 404 error response
     $response = $this->controller->createNotFoundException('Not found response');
     $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\Response', $response);
     $this->assertContains('Not found response', $response->getContent());
     $this->assertEquals(404, $response->getStatusCode());
     // 403 error response
     $response = $this->controller->createNotAllowedException('Forbidden response');
     $this->assertInstanceOf('\\Symfony\\Component\\HttpFoundation\\Response', $response);
     $this->assertContains('Forbidden response', $response->getContent());
     $this->assertEquals(403, $response->getStatusCode());
 }