Skip to content

Commit

Permalink
Added a test for the exception's status code. Not perfect as it doesn…
Browse files Browse the repository at this point in the history
…'t test the header is sent, but still good. Fixes #1
  • Loading branch information
Gisleburt committed Dec 30, 2014
1 parent 169ad3f commit 05f1c45
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/ApiTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ public function testInvalidEndpoint() {

ob_start();

$api->go()->respond();
$response = $api->go();
$response->respond();

$output = json_decode(ob_get_clean());

Expand All @@ -140,6 +141,11 @@ public function testInvalidEndpoint() {
'Exception should have been caught and returned an appropriate error to the user'
);

$this->assertSame(
$response->getStatus()->getHttpHeader(), 'HTTP/1.1 404 Not Found',
'Incorrect header response, got '.$response->getStatus()->getHttpHeader()
);

}

/**
Expand Down

0 comments on commit 05f1c45

Please sign in to comment.