From 780deb4f58765c284e9922e6b6906ab37682fc55 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 22 Sep 2023 23:25:20 +0000 Subject: [PATCH] fix tests --- .../CsvListExporter/defaultCsvExporter.csv.php | 1 + .../defaultExcelExporter.xls.php | 5 ++++- .../defaultPdfListExporter.pdf.php | 1 + .../defaultWordLetterExporter.doc.php | 5 ++++- .../defaultWordListExporter.doc.php | 1 + .../defaultWordExporter.doc.php | 5 ++++- Controller/ApiController.php | 16 ++++++++++------ Models/AccountCredentialMapper.php | 2 +- .../AccountPermissionSelector/BaseView.php | 2 +- 9 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php b/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php index bf9cc516..45af8be9 100755 --- a/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php +++ b/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php @@ -13,6 +13,7 @@ declare(strict_types=1); /** @var \phpOMS\Views\View $this */ +/** @var array $data */ $data = $this->data['data'] ?? []; $out = \fopen('php://output', 'w'); diff --git a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php index 2f0fb62d..9259928a 100755 --- a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php +++ b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php @@ -21,8 +21,11 @@ Autoloader::addPath(__DIR__ . '/../Resources'); /** @var \phpOMS\Views\View $this */ +/** @var \Modules\Media\Models\Collection $media */ $media = $this->getData('media'); -$data = $this->getData('data') ?? []; + +/** @var array $data */ +$data = $this->getData('data') ?? []; include $media->getSourceByName('template.php')->getAbsolutePath(); diff --git a/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php b/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php index e2e2f915..945a65a5 100755 --- a/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php +++ b/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php @@ -19,6 +19,7 @@ Autoloader::addPath(__DIR__ . '/../Resources'); /** @var \phpOMS\Views\View $this */ +/** @var \Modules\Media\Models\Collection $media */ $media = $this->data['media']; /** @var array $data */ diff --git a/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php b/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php index ac2e64d6..5eaaa2b5 100755 --- a/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php +++ b/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php @@ -19,8 +19,11 @@ Autoloader::addPath(__DIR__ . '/../Resources'); /** @var \phpOMS\Views\View $this */ +/** @var \Modules\Media\Models\Collection $media */ $media = $this->data['media']; -$data = $this->data['data'] ?? []; + +/** @var array $data */ +$data = $this->data['data'] ?? []; include $media->getSourceByName('template.php')->getAbsolutePath(); diff --git a/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php b/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php index 614060ae..a19e431d 100755 --- a/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php +++ b/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php @@ -19,6 +19,7 @@ Autoloader::addPath(__DIR__ . '/../Resources'); /** @var \phpOMS\Views\View $this */ +/** @var \Modules\Media\Models\Collection $media */ $media = $this->data['media']; /** @var array $data */ diff --git a/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php b/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php index 6a6d77e4..e9ec86ec 100755 --- a/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php +++ b/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php @@ -19,8 +19,11 @@ Autoloader::addPath(__DIR__ . '/../Resources'); /** @var \phpOMS\Views\View $this */ +/** @var \Modules\Media\Models\Collection $media */ $media = $this->data['media']; -$data = $this->data['data'] ?? []; + +/** @var array $data */ +$data = $this->data['data'] ?? []; include $media->getSourceByName('template.php')->getAbsolutePath(); diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 6d977438..ef262e2c 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -530,10 +530,10 @@ public function apiSettingsGet(RequestAbstract $request, ResponseAbstract $respo [ 'response' => $this->app->appSettings->get( $request->getDataInt('id'), - $request->getData('name'), + $request->getDataString('name'), $request->getDataInt('unit'), $request->getDataInt('app'), - $request->getData('module'), + $request->getDataString('module'), $request->getDataInt('group'), $request->getDataInt('account') ), @@ -863,8 +863,8 @@ public function apiSettingsAccountLocalizationSet(RequestAbstract $request, Resp ->where('id', $accountId) ->execute(); - if (($request->getData('localization_load') ?? '-1') !== '-1') { - $locale = \explode('_', $request->getData('localization_load') ?? ''); + if (($request->getDataString('localization_load') ?? '-1') !== '-1') { + $locale = \explode('_', $request->getDataString('localization_load') ?? ''); $old = clone $account->l11n; $account->l11n->loadFromLanguage($locale[0], $locale[1]); @@ -2032,7 +2032,11 @@ public function apiDataChange(RequestAbstract $request, ResponseAbstract $respon $new = clone $old; $data = \json_decode($dataChange->data, true); - $new->setStatus((int) $data['status']); + if (!\is_array($data)) { + break; + } + + $new->setStatus((int) ($data['status'] ?? -1)); $this->updateModel($dataChange->createdBy, $old, $new, AccountMapper::class, 'datachange', $request->getOrigin()); $this->deleteModel($dataChange->createdBy, $dataChange, DataChangeMapper::class, 'datachange', $request->getOrigin()); @@ -3313,7 +3317,7 @@ public function apiApplicationDelete(RequestAbstract $request, ResponseAbstract return; } - /** @var \Modules\Admin\Models\Application $application */ + /** @var \Modules\Admin\Models\App $application */ $application = AppMapper::get()->where('id', (int) $request->getData('id'))->execute(); $this->deleteModel($request->header->account, $application, AppMapper::class, 'application', $request->getOrigin()); $this->createStandardDeleteResponse($request, $response, $application); diff --git a/Models/AccountCredentialMapper.php b/Models/AccountCredentialMapper.php index aa61c189..6ae318f9 100755 --- a/Models/AccountCredentialMapper.php +++ b/Models/AccountCredentialMapper.php @@ -23,7 +23,7 @@ * @since 1.0.0 * * @template T of Account - * @extends AccountMapper + * @extends AccountMapper */ final class AccountCredentialMapper extends AccountMapper { diff --git a/Theme/Backend/Components/AccountPermissionSelector/BaseView.php b/Theme/Backend/Components/AccountPermissionSelector/BaseView.php index c4bb59ef..d2a224e0 100644 --- a/Theme/Backend/Components/AccountPermissionSelector/BaseView.php +++ b/Theme/Backend/Components/AccountPermissionSelector/BaseView.php @@ -71,7 +71,7 @@ public function __construct(L11nManager $l11n = null, RequestAbstract $request, public function render(mixed ...$data) : string { /** @var array{0:string, 1?:string, 2?:string} $data */ - $this->form = $data[0]; + $this->id = $data[0]; $this->name = $data[1] ?? 'UNDEFINED'; $this->virtualPath = $data[2] ?? $this->virtualPath; $this->permissions = $data[3] ?? $this->permissions;