summaryrefslogtreecommitdiff
path: root/tests/Unit/Controllers/CreditsControllerTest.php
blob: 303bf60ec031ad4fc143cb9fae3c0a79c9e3de3b (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
31
32
33
34
35
36
<?php

namespace Engelsystem\Test\Unit\Controllers;

use Engelsystem\Config\Config;
use Engelsystem\Controllers\CreditsController;
use Engelsystem\Helpers\Version;
use Engelsystem\Http\Response;
use Engelsystem\Test\Unit\TestCase;
use PHPUnit\Framework\MockObject\MockObject;

class CreditsControllerTest extends TestCase
{
    /**
     * @covers \Engelsystem\Controllers\CreditsController::__construct
     * @covers \Engelsystem\Controllers\CreditsController::index
     */
    public function testIndex()
    {
        /** @var Response|MockObject $response */
        $response = $this->createMock(Response::class);
        $config = new Config(['foo' => 'bar', 'credits' => ['lor' => 'em']]);
        /** @var Version|MockObject $version */
        $version = $this->createMock(Version::class);

        $this->setExpects(
            $response,
            'withView',
            ['pages/credits.twig', ['credits' => ['lor' => 'em'], 'version' => '42.1.0-test']]
        );
        $this->setExpects($version, 'getVersion', [], '42.1.0-test');

        $controller = new CreditsController($response, $config, $version);
        $controller->index();
    }
}