engelsystem/tests/Unit/Controllers/HomeControllerTest.php

34 lines
1.1 KiB
PHP
Raw Normal View History

2019-06-14 04:05:38 +02:00
<?php
namespace Engelsystem\Test\Unit\Controllers;
use Engelsystem\Config\Config;
use Engelsystem\Controllers\HomeController;
use Engelsystem\Helpers\Authenticator;
2020-05-10 15:55:44 +02:00
use Engelsystem\Http\Redirector;
use Engelsystem\Http\Response;
use Engelsystem\Models\User\User;
2019-06-14 04:05:38 +02:00
use Engelsystem\Test\Unit\TestCase;
use PHPUnit\Framework\MockObject\MockObject;
class HomeControllerTest extends TestCase
{
/**
* @covers \Engelsystem\Controllers\HomeController::__construct
* @covers \Engelsystem\Controllers\HomeController::index
*/
public function testIndex()
{
$config = new Config(['home_site' => '/foo']);
/** @var Authenticator|MockObject $auth */
$auth = $this->createMock(Authenticator::class);
$this->setExpects($auth, 'user', null, new User());
2020-05-10 15:55:44 +02:00
/** @var Redirector|MockObject $redirect */
$redirect = $this->createMock(Redirector::class);
$this->setExpects($redirect, 'to', ['/foo'], new Response());
2019-06-14 04:05:38 +02:00
2020-05-10 15:55:44 +02:00
$controller = new HomeController($auth, $config, $redirect);
2019-06-14 04:05:38 +02:00
$controller->index();
}
}