summaryrefslogtreecommitdiff
path: root/tests/Unit/Controllers/HomeControllerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Controllers/HomeControllerTest.php')
-rw-r--r--tests/Unit/Controllers/HomeControllerTest.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/Unit/Controllers/HomeControllerTest.php b/tests/Unit/Controllers/HomeControllerTest.php
new file mode 100644
index 00000000..56bb1995
--- /dev/null
+++ b/tests/Unit/Controllers/HomeControllerTest.php
@@ -0,0 +1,30 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Controllers;
+
+use Engelsystem\Config\Config;
+use Engelsystem\Controllers\HomeController;
+use Engelsystem\Helpers\Authenticator;
+use Engelsystem\Http\Exceptions\HttpTemporaryRedirect;
+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, true);
+
+ $controller = new HomeController($auth, $config);
+
+ $this->expectException(HttpTemporaryRedirect::class);
+ $controller->index();
+ }
+}