diff options
-rw-r--r-- | tests/Feature/ApplicationFeatureTest.php | 2 | ||||
-rw-r--r-- | tests/Feature/Controllers/Metrics/ControllerTest.php | 23 | ||||
-rw-r--r-- | tests/Feature/Model/RoomModelTest.php | 5 |
3 files changed, 27 insertions, 3 deletions
diff --git a/tests/Feature/ApplicationFeatureTest.php b/tests/Feature/ApplicationFeatureTest.php index 3cd8b376..6ac42bce 100644 --- a/tests/Feature/ApplicationFeatureTest.php +++ b/tests/Feature/ApplicationFeatureTest.php @@ -9,6 +9,6 @@ abstract class ApplicationFeatureTest extends TestCase public static function setUpBeforeClass(): void { $_SERVER['HTTP_HOST'] = 'foo.bar'; - require_once __DIR__ . '/../../includes/engelsystem.php'; + require __DIR__ . '/../../includes/engelsystem.php'; } } diff --git a/tests/Feature/Controllers/Metrics/ControllerTest.php b/tests/Feature/Controllers/Metrics/ControllerTest.php new file mode 100644 index 00000000..8f8f102b --- /dev/null +++ b/tests/Feature/Controllers/Metrics/ControllerTest.php @@ -0,0 +1,23 @@ +<?php + +namespace Engelsystem\Test\Feature\Controllers\Metrics; + +use Engelsystem\Controllers\Metrics\Controller; +use Engelsystem\Test\Feature\ApplicationFeatureTest; + +class ControllerTest extends ApplicationFeatureTest +{ + /** + * @covers \Engelsystem\Controllers\Metrics\Controller::metrics + */ + public function testMetrics() + { + config(['api_key' => null]); + + /** @var Controller $controller */ + $controller = app()->make(Controller::class); + $response = $controller->metrics(); + + $this->assertEquals(200, $response->getStatusCode()); + } +} diff --git a/tests/Feature/Model/RoomModelTest.php b/tests/Feature/Model/RoomModelTest.php index 3ed4bcd2..f86359e0 100644 --- a/tests/Feature/Model/RoomModelTest.php +++ b/tests/Feature/Model/RoomModelTest.php @@ -2,10 +2,11 @@ namespace Engelsystem\Test\Feature\Model; -use PHPUnit\Framework\TestCase; +use Engelsystem\Test\Feature\ApplicationFeatureTest; -class RoomModelTest extends TestCase +class RoomModelTest extends ApplicationFeatureTest { + /** @var int */ private $room_id = null; /** |