summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-11-20 18:55:56 +0100
committermsquare <msquare@notrademark.de>2019-06-12 10:20:08 +0200
commite948091066e4893b1b823fc80db1c1ebba174b53 (patch)
tree1bc34bf1f476abcafe536336955916ac9d929a68 /tests/Unit
parent93e578e555b6e40c1e26d85e4f32b87577f54def (diff)
Replaced old /api endpoint with ApiController
Diffstat (limited to 'tests/Unit')
-rw-r--r--tests/Unit/Controllers/ApiControllerTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/Unit/Controllers/ApiControllerTest.php b/tests/Unit/Controllers/ApiControllerTest.php
new file mode 100644
index 00000000..7e437e12
--- /dev/null
+++ b/tests/Unit/Controllers/ApiControllerTest.php
@@ -0,0 +1,25 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Controllers;
+
+use Engelsystem\Controllers\ApiController;
+use Engelsystem\Http\Response;
+use PHPUnit\Framework\TestCase;
+
+class ApiControllerTest extends TestCase
+{
+ /**
+ * @covers \Engelsystem\Controllers\ApiController::__construct
+ * @covers \Engelsystem\Controllers\ApiController::index
+ */
+ public function testIndex()
+ {
+ $controller = new ApiController(new Response());
+
+ $response = $controller->index();
+
+ $this->assertEquals(501, $response->getStatusCode());
+ $this->assertEquals(['application/json'], $response->getHeader('content-type'));
+ $this->assertJson($response->getContent());
+ }
+}