Merge pull request #3 from Karaka-Management/develop

Develop
This commit is contained in:
Dennis Eichhorn 2023-09-30 18:49:48 +02:00 committed by GitHub
commit fd58fc6ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -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');
}

View File

@ -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())));
}
}