summaryrefslogtreecommitdiff
path: root/tests/Unit/Controllers/ApiControllerTest.php
blob: 7e437e124f79227a8c76c425b6d7b22c3df776f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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());
    }
}