summaryrefslogtreecommitdiff
path: root/tests/Unit/Controllers/CreditsControllerTest.php
blob: 3ce92cb1dcc3e7244b4984b09bb55b7b4e3ac551 (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 Unit\Controllers;

use Engelsystem\Config\Config;
use Engelsystem\Controllers\CreditsController;
use Engelsystem\Http\Response;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

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']]);

        $response->expects($this->once())
            ->method('withView')
            ->with('pages/credits.twig', ['credits' => ['lor' => 'em']]);

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