Skip to content

Commit

Permalink
Merge branch 'dopesong-error-handler-phpunit' into 3.x
Browse files Browse the repository at this point in the history
Closes #1879
  • Loading branch information
akrabat committed May 19, 2016
2 parents 79ba882 + fa6e9ad commit e3b7ce8
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/Handlers/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,25 @@ public function errorProvider()
public function testError($acceptHeader, $contentType, $startOfBody)
{
$error = new Error();
$e = new \Exception("Oops");
$e = new \Exception("Oops", 1, new \Exception('Previous oops'));

/** @var Response $res */
$res = $error->__invoke($this->getRequest('GET', $acceptHeader), new Response(), $e);

$this->assertSame(500, $res->getStatusCode());
$this->assertSame($contentType, $res->getHeaderLine('Content-Type'));
$this->assertEquals(0, strpos((string)$res->getBody(), $startOfBody));
}

/**
* Test invalid method returns the correct code and content type with details
*
* @dataProvider errorProvider
*/
public function testErrorDisplayDetails($acceptHeader, $contentType, $startOfBody)
{
$error = new Error(true);
$e = new \Exception('Oops', 1, new \Exception('Opps before'));

/** @var Response $res */
$res = $error->__invoke($this->getRequest('GET', $acceptHeader), new Response(), $e);
Expand Down

0 comments on commit e3b7ce8

Please sign in to comment.