From 922c738951cbdc31ca760dcd53c5227fda15e5db Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 19 May 2023 02:37:35 +0000 Subject: [PATCH] test fixes + new test data --- Admin/Installer.php | 4 ++-- Admin/Updater.php | 7 +++++++ Theme/Api/render.tpl.php | 5 ++++- Theme/Backend/Components/InlinePreview/BaseView.php | 2 +- tests/Models/MediaTest.php | 1 - 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Admin/Installer.php b/Admin/Installer.php index 05f8eb8..9fe40e9 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -57,8 +57,8 @@ final class Installer extends InstallerAbstract \mkdir(__DIR__ . '/../Files'); } - if (!\is_dir(__DIR__ . '/../../../Temp')) { - \mkdir(__DIR__ . '/../../../Temp'); + if (!\is_dir(__DIR__ . '/../../../temp')) { + \mkdir(__DIR__ . '/../../../temp'); } parent::install($app, $info, $cfgHandler); diff --git a/Admin/Updater.php b/Admin/Updater.php index 93be03d..eca340b 100755 --- a/Admin/Updater.php +++ b/Admin/Updater.php @@ -26,4 +26,11 @@ use phpOMS\Module\UpdaterAbstract; */ final class Updater extends UpdaterAbstract { + /** + * Path of the file + * + * @var string + * @since 1.0.0 + */ + public const PATH = __DIR__; } diff --git a/Theme/Api/render.tpl.php b/Theme/Api/render.tpl.php index fe913b5..b5da545 100755 --- a/Theme/Api/render.tpl.php +++ b/Theme/Api/render.tpl.php @@ -12,7 +12,10 @@ */ declare(strict_types=1); -$media = $this->getData('media'); +use Modules\Media\Models\NullMedia; + +/** @var \Modules\Media\Models\Media $media */ +$media = $this->getData('media') ?? new NullMedia(); $fp = \fopen(($media->isAbsolute ? '' : __DIR__ . '/../../../../') . $media->getPath(), 'r'); \fpassthru($fp); diff --git a/Theme/Backend/Components/InlinePreview/BaseView.php b/Theme/Backend/Components/InlinePreview/BaseView.php index 6ad0516..77624fb 100755 --- a/Theme/Backend/Components/InlinePreview/BaseView.php +++ b/Theme/Backend/Components/InlinePreview/BaseView.php @@ -36,7 +36,7 @@ class BaseView extends View * @var string * @since 1.0.0 */ - protected string $id = ''; + public string $id = ''; /** * Form id diff --git a/tests/Models/MediaTest.php b/tests/Models/MediaTest.php index 81b873a..47d9278 100755 --- a/tests/Models/MediaTest.php +++ b/tests/Models/MediaTest.php @@ -52,7 +52,6 @@ final class MediaTest extends \PHPUnit\Framework\TestCase self::assertEquals('/', $this->media->getVirtualPath()); self::assertEquals(0, $this->media->size); self::assertFalse($this->media->isVersioned); - self::assertFalse($this->media->isEncrypted()); } /**