summaryrefslogtreecommitdiff
path: root/tests/Unit/Controllers/HomeControllerTest.php
blob: 56bb1995a69e749b29eaf0d03f92edd23e0da550 (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
26
27
28
29
30
<?php

namespace Engelsystem\Test\Unit\Controllers;

use Engelsystem\Config\Config;
use Engelsystem\Controllers\HomeController;
use Engelsystem\Helpers\Authenticator;
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
use Engelsystem\Test\Unit\TestCase;
use PHPUnit\Framework\MockObject\MockObject;

class HomeControllerTest extends TestCase
{
    /**
     * @covers \Engelsystem\Controllers\HomeController::__construct
     * @covers \Engelsystem\Controllers\HomeController::index
     */
    public function testIndex()
    {
        $config = new Config(['home_site' => '/foo']);
        /** @var Authenticator|MockObject $auth */
        $auth = $this->createMock(Authenticator::class);
        $this->setExpects($auth, 'user', null, true);

        $controller = new HomeController($auth, $config);

        $this->expectException(HttpTemporaryRedirect::class);
        $controller->index();
    }
}