From 77834fb493c83de952fb14fb908df49efc0697b5 Mon Sep 17 00:00:00 2001 From: Graham Campbell Date: Thu, 18 Jun 2015 18:15:16 +0100 Subject: [PATCH] Added more api tests --- tests/Api/GeneralTest.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/Api/GeneralTest.php b/tests/Api/GeneralTest.php index 635d8962..e44f257b 100644 --- a/tests/Api/GeneralTest.php +++ b/tests/Api/GeneralTest.php @@ -20,5 +20,26 @@ class GeneralTest extends AbstractTestCase $this->get('/api/v1/ping'); $this->seeJson(['data' => 'Pong!']); $this->assertResponseOk(); + $this->seeHeader('Content-Type', 'application/json'); + } + + public function testErrorPage() + { + $this->get('/api/v1/not-found'); + + $this->assertResponseStatus(404); + $this->seeHeader('Content-Type', 'application/json'); + $this->seeJson(['errors' => [[ + 'status' => 404, + 'title' => 'Not Found', + 'detail' => 'The requested resource could not be found but may be available again in the future.', + ]]]); + } + + public function testNotAcceptableContentType() + { + $this->get('/api/v1/ping', ['HTTP_Accept' => 'text/html']); + + $this->assertResponseStatus(406); } }