From 9d239ebd98bce2ceef18f146118ee6b888d53bf4 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Mon, 11 Oct 2021 22:56:16 +0200 Subject: [PATCH] fix tests --- Application/ApplicationManager.php | 10 +++++----- tests/Application/ApplicationManagerTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Application/ApplicationManager.php b/Application/ApplicationManager.php index 0784d051c..e46003ec6 100644 --- a/Application/ApplicationManager.php +++ b/Application/ApplicationManager.php @@ -97,11 +97,7 @@ final class ApplicationManager $destination = \rtrim($destination, '\\/'); $source = \rtrim($source, '/\\'); - if (!\is_dir(\dirname($destination))) { - Directory::create(\dirname($destination), 0755, true); - } - - if (!\is_dir($source) || ($path = \realpath($destination)) === false + if (!\is_dir($source) || \is_dir($destination) || !\is_file($source . '/Admin/Installer.php') ) { return false; @@ -114,6 +110,10 @@ final class ApplicationManager $this->installFiles($source, $destination); $this->replacePlaceholder($destination); + if (($path = \realpath($destination)) === false) { + return false; // @codeCoverageIgnore + } + $classPath = \substr($path . '/Admin/Installer', (int) \strlen((string) \realpath(__DIR__ . '/../../'))); // @var class-string $class diff --git a/tests/Application/ApplicationManagerTest.php b/tests/Application/ApplicationManagerTest.php index 122d8f231..15f4ee0fe 100644 --- a/tests/Application/ApplicationManagerTest.php +++ b/tests/Application/ApplicationManagerTest.php @@ -109,7 +109,7 @@ class ApplicationManagerTest extends \PHPUnit\Framework\TestCase { Directory::delete(__DIR__ . '/Apps/Testapp'); - $this->appManager->install(__DIR__ . '/Testapp', __DIR__ . '/Apps/Testapp'); + self::assertTrue($this->appManager->install(__DIR__ . '/Testapp', __DIR__ . '/Apps/Testapp')); $this->appManager->reInit(__DIR__ . '/Apps/Testapp'); self::assertEquals($r1 = include __DIR__ . '/Testapp/Admin/Install/Application/Routes.php', $r2 = include __DIR__ . '/Apps/Testapp/Routes.php');