diff --git a/public_html/api-dispatch.php b/public_html/api-dispatch.php
index dc7066b0..ae325a0c 100644
--- a/public_html/api-dispatch.php
+++ b/public_html/api-dispatch.php
@@ -1,9 +1,8 @@
run();
diff --git a/src/Helpers/InputReader.php b/src/Helpers/InputReader.php
index 43f616f2..d8b72ccb 100644
--- a/src/Helpers/InputReader.php
+++ b/src/Helpers/InputReader.php
@@ -6,7 +6,7 @@ final class InputReader
public function __construct()
{
$_PUT = [];
- if ($_SERVER['REQUEST_METHOD'] == 'PUT')
+ if (isset($_SERVER['REQUEST_METHOD']) and $_SERVER['REQUEST_METHOD'] == 'PUT')
parse_str(file_get_contents('php://input'), $_PUT);
foreach ([$_GET, $_POST, $_PUT] as $source)
diff --git a/src/Injector.php b/src/Injector.php
index d6a41483..4f8b665f 100644
--- a/src/Injector.php
+++ b/src/Injector.php
@@ -7,9 +7,14 @@ final class Injector
public static function init()
{
+ $definitionsPath = __DIR__
+ . DIRECTORY_SEPARATOR . '..'
+ . DIRECTORY_SEPARATOR . 'src'
+ . DIRECTORY_SEPARATOR . 'di.php';
+
$builder = new \DI\ContainerBuilder();
$builder->setDefinitionCache(new \Doctrine\Common\Cache\ArrayCache());
- $builder->addDefinitions(__DIR__ . DS . '..' . DS . 'src' . DS . 'di.php');
+ $builder->addDefinitions($definitionsPath);
self::$container = $builder->build();
}
diff --git a/src/di.php b/src/di.php
index d75b294a..290e8ce7 100644
--- a/src/di.php
+++ b/src/di.php
@@ -1,8 +1,8 @@
DI\object()->constructor([
- __DIR__ . DS . '..' . DS . 'data' . DS . 'config.ini',
- __DIR__ . DS . '..' . DS . 'data' . DS . 'local.ini']),
+ __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'config.ini',
+ __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'local.ini']),
\Szurubooru\ControllerRepository::class => DI\object()->constructor(DI\link('controllers')),
diff --git a/tests/ControllerRepositoryTest.php b/tests/ControllerRepositoryTest.php
new file mode 100644
index 00000000..debe8a1d
--- /dev/null
+++ b/tests/ControllerRepositoryTest.php
@@ -0,0 +1,16 @@
+assertNotEmpty($controllerRepository->getControllers());
+ }
+}