From 2f5262f8aadd45d3771d71ad1c95889454e844f2 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 30 Sep 2023 16:09:02 +0000 Subject: [PATCH 1/2] improve testing --- tests/Controller/ApiControllerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 8e927c6..b8abe7d 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -98,6 +98,9 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase */ public function testApiSearch() : void { + $searchRoutes = include __DIR__ . '/../../Admin/SearchCommands.php'; + self::assertGreaterThan(0, \count($searchRoutes)); + $response = new HttpResponse(); $request = new HttpRequest(new HttpUri('')); @@ -105,6 +108,6 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase $request->setData('search', ':help introduction'); $this->module->routeSearch($request, $response); - self::assertGreaterThan(0, \count($response->get(''))); + self::assertGreaterThan(0, \count($response->get($request->uri->__toString()))); } } From 1fcaa98eba05f80c4da8e56a741b143de37d795e Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 30 Sep 2023 16:26:10 +0000 Subject: [PATCH 2/2] fix permission check --- Admin/Installer.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index faa5c52..50c974b 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -45,11 +45,15 @@ final class Installer extends InstallerAbstract */ public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void { - if (!\is_writable(__DIR__ . '/SearchCommands.php')) { - throw new PermissionException(__DIR__ . '/SearchCommands.php'); + if (!\is_writable(__DIR__ . '/')) { + throw new PermissionException(__DIR__ . '/'); } if (\is_file(__DIR__ . '/SearchCommands.php')) { + if (!\is_writable(__DIR__ . '/SearchCommands.php')) { + throw new PermissionException(__DIR__ . '/SearchCommands.php'); + } + \unlink(__DIR__ . '/SearchCommands.php'); }