summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-06-14 04:05:38 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2019-06-14 04:15:20 +0200
commite06affae179dfeb41f77d8ad2ea81fa3f2fa439d (patch)
tree010d2501d5d2267fa8b24277295de623e3e76aba /tests/Unit
parent9232513831501e8a0cb4f14299cd8f85afe7bc7f (diff)
Added tests to HomeController
Diffstat (limited to 'tests/Unit')
-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();
+ }
+}