engelsystem/tests/Unit/Controllers/CreditsControllerTest.php

39 lines
1.2 KiB
PHP
Raw Normal View History

2018-09-02 02:13:18 +02:00
<?php
declare(strict_types=1);
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;
use Engelsystem\Helpers\Version;
2018-09-02 02:13:18 +02:00
use Engelsystem\Http\Response;
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
*/
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']]);
/** @var Version|MockObject $version */
$version = $this->createMock(Version::class);
2018-09-02 02:13:18 +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
$controller = new CreditsController($response, $config, $version);
2018-09-02 02:13:18 +02:00
$controller->index();
}
}