2018-09-02 02:13:18 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Unit\Controllers;
|
|
|
|
|
2018-12-21 23:12:04 +01:00
|
|
|
use Engelsystem\Config\Config;
|
2018-09-02 02:13:18 +02:00
|
|
|
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);
|
2018-12-21 23:12:04 +01:00
|
|
|
$config = new Config(['foo' => 'bar', 'credits' => ['lor' => 'em']]);
|
2018-09-02 02:13:18 +02:00
|
|
|
|
|
|
|
$response->expects($this->once())
|
|
|
|
->method('withView')
|
2018-12-21 23:12:04 +01:00
|
|
|
->with('pages/credits.twig', ['credits' => ['lor' => 'em']]);
|
2018-09-02 02:13:18 +02:00
|
|
|
|
2018-12-21 23:12:04 +01:00
|
|
|
$controller = new CreditsController($response, $config);
|
2018-09-02 02:13:18 +02:00
|
|
|
$controller->index();
|
|
|
|
}
|
|
|
|
}
|