summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/Feature/ApplicationFeatureTest.php14
-rw-r--r--tests/Feature/Logger/EngelsystemLoggerTest.php9
-rw-r--r--tests/Feature/Model/LogEntriesModelTest.php9
-rw-r--r--tests/Feature/Model/RoomModelTest.php5
4 files changed, 18 insertions, 19 deletions
diff --git a/tests/Feature/ApplicationFeatureTest.php b/tests/Feature/ApplicationFeatureTest.php
new file mode 100644
index 00000000..fc6216f1
--- /dev/null
+++ b/tests/Feature/ApplicationFeatureTest.php
@@ -0,0 +1,14 @@
+<?php
+
+namespace Engelsystem\Test\Feature;
+
+use PHPUnit\Framework\TestCase;
+
+abstract class ApplicationFeatureTest extends TestCase
+{
+ public static function setUpBeforeClass()
+ {
+ $_SERVER['HTTP_HOST'] = 'foo.bar';
+ require_once __DIR__ . '/../../includes/engelsystem.php';
+ }
+}
diff --git a/tests/Feature/Logger/EngelsystemLoggerTest.php b/tests/Feature/Logger/EngelsystemLoggerTest.php
index 8886d4ba..ce7b8ac5 100644
--- a/tests/Feature/Logger/EngelsystemLoggerTest.php
+++ b/tests/Feature/Logger/EngelsystemLoggerTest.php
@@ -3,18 +3,13 @@
namespace Engelsystem\Test\Feature\Logger;
use Engelsystem\Logger\EngelsystemLogger;
-use PHPUnit\Framework\TestCase;
+use Engelsystem\Test\Feature\ApplicationFeatureTest;
use Psr\Log\InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
-class EngelsystemLoggerTest extends TestCase
+class EngelsystemLoggerTest extends ApplicationFeatureTest
{
- public static function setUpBeforeClass()
- {
- require_once __DIR__ . '/../../../includes/engelsystem.php';
- }
-
/**
* @return LoggerInterface
*/
diff --git a/tests/Feature/Model/LogEntriesModelTest.php b/tests/Feature/Model/LogEntriesModelTest.php
index 036f5692..c032a94c 100644
--- a/tests/Feature/Model/LogEntriesModelTest.php
+++ b/tests/Feature/Model/LogEntriesModelTest.php
@@ -2,16 +2,11 @@
namespace Engelsystem\Test\Feature\Model;
-use PHPUnit\Framework\TestCase;
+use Engelsystem\Test\Feature\ApplicationFeatureTest;
use Psr\Log\LogLevel;
-class LogEntriesModelTest extends TestCase
+class LogEntriesModelTest extends ApplicationFeatureTest
{
- public static function setUpBeforeClass()
- {
- require_once __DIR__ . '/../../../includes/engelsystem.php';
- }
-
public function testCreateLogEntry()
{
LogEntries_clear_all();
diff --git a/tests/Feature/Model/RoomModelTest.php b/tests/Feature/Model/RoomModelTest.php
index 22aa4b8e..216c87da 100644
--- a/tests/Feature/Model/RoomModelTest.php
+++ b/tests/Feature/Model/RoomModelTest.php
@@ -8,11 +8,6 @@ class RoomModelTest extends TestCase
{
private $room_id = null;
- public static function setUpBeforeClass()
- {
- require_once __DIR__ . '/../../../includes/engelsystem.php';
- }
-
public function createRoom()
{
$this->room_id = Room_create('test', false, null, null);