|
|
|
@ -5,7 +5,8 @@ namespace Engelsystem\Test\Unit\Controllers;
|
|
|
|
|
use Engelsystem\Config\Config;
|
|
|
|
|
use Engelsystem\Controllers\HomeController;
|
|
|
|
|
use Engelsystem\Helpers\Authenticator;
|
|
|
|
|
use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
|
|
|
|
|
use Engelsystem\Http\Redirector;
|
|
|
|
|
use Engelsystem\Http\Response;
|
|
|
|
|
use Engelsystem\Test\Unit\TestCase;
|
|
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
|
|
|
|
|
|
|
|
@ -21,10 +22,11 @@ class HomeControllerTest extends TestCase
|
|
|
|
|
/** @var Authenticator|MockObject $auth */
|
|
|
|
|
$auth = $this->createMock(Authenticator::class);
|
|
|
|
|
$this->setExpects($auth, 'user', null, true);
|
|
|
|
|
/** @var Redirector|MockObject $redirect */
|
|
|
|
|
$redirect = $this->createMock(Redirector::class);
|
|
|
|
|
$this->setExpects($redirect, 'to', ['/foo'], new Response());
|
|
|
|
|
|
|
|
|
|
$controller = new HomeController($auth, $config);
|
|
|
|
|
|
|
|
|
|
$this->expectException(HttpTemporaryRedirect::class);
|
|
|
|
|
$controller = new HomeController($auth, $config, $redirect);
|
|
|
|
|
$controller->index();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|