2018-09-02 02:13:18 +02:00
|
|
|
<?php
|
|
|
|
|
2018-10-25 18:53:05 +02:00
|
|
|
namespace Engelsystem\Test\Unit\Controllers;
|
2018-09-02 02:13:18 +02:00
|
|
|
|
2018-12-21 23:12:04 +01:00
|
|
|
use Engelsystem\Config\Config;
|
2018-09-02 02:13:18 +02:00
|
|
|
use Engelsystem\Controllers\CreditsController;
|
2019-07-21 02:34:52 +02:00
|
|
|
use Engelsystem\Helpers\Version;
|
2018-09-02 02:13:18 +02:00
|
|
|
use Engelsystem\Http\Response;
|
2019-07-21 02:34:52 +02:00
|
|
|
use Engelsystem\Test\Unit\TestCase;
|
2018-09-02 02:13:18 +02:00
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
|
|
|
|
|
|
class CreditsControllerTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Controllers\CreditsController::__construct
|
|
|
|
* @covers \Engelsystem\Controllers\CreditsController::index
|
|
|
|
*/
|
2022-12-14 19:15:20 +01:00
|
|
|
public function testIndex(): void
|
2018-09-02 02:13:18 +02:00
|
|
|
{
|
|
|
|
/** @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']]);
|
2019-07-21 02:34:52 +02:00
|
|
|
/** @var Version|MockObject $version */
|
|
|
|
$version = $this->createMock(Version::class);
|
2018-09-02 02:13:18 +02:00
|
|
|
|
2019-07-21 02:34:52 +02:00
|
|
|
$this->setExpects(
|
|
|
|
$response,
|
|
|
|
'withView',
|
|
|
|
['pages/credits.twig', ['credits' => ['lor' => 'em'], 'version' => '42.1.0-test']]
|
|
|
|
);
|
|
|
|
$this->setExpects($version, 'getVersion', [], '42.1.0-test');
|
2018-09-02 02:13:18 +02:00
|
|
|
|
2019-07-21 02:34:52 +02:00
|
|
|
$controller = new CreditsController($response, $config, $version);
|
2018-09-02 02:13:18 +02:00
|
|
|
$controller->index();
|
|
|
|
}
|
|
|
|
}
|