fix tests

This commit is contained in:
Dennis Eichhorn 2023-09-22 23:25:20 +00:00
parent 0af851136b
commit 780deb4f58
9 changed files with 27 additions and 11 deletions

View File

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

View File

@ -21,8 +21,11 @@ use phpOMS\Utils\StringUtils;
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();

View File

@ -19,6 +19,7 @@ use phpOMS\Autoloader;
Autoloader::addPath(__DIR__ . '/../Resources');
/** @var \phpOMS\Views\View $this */
/** @var \Modules\Media\Models\Collection $media */
$media = $this->data['media'];
/** @var array<array> $data */

View File

@ -19,8 +19,11 @@ use phpOMS\Autoloader;
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();

View File

@ -19,6 +19,7 @@ use phpOMS\Autoloader;
Autoloader::addPath(__DIR__ . '/../Resources');
/** @var \phpOMS\Views\View $this */
/** @var \Modules\Media\Models\Collection $media */
$media = $this->data['media'];
/** @var array<array> $data */

View File

@ -19,8 +19,11 @@ use phpOMS\Autoloader;
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();

View File

@ -530,10 +530,10 @@ final class ApiController extends Controller
[
'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 @@ final class ApiController extends Controller
->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 @@ final class ApiController extends Controller
$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 @@ final class ApiController extends Controller
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);

View File

@ -23,7 +23,7 @@ namespace Modules\Admin\Models;
* @since 1.0.0
*
* @template T of Account
* @extends AccountMapper<T>
* @extends AccountMapper<Account>
*/
final class AccountCredentialMapper extends AccountMapper
{

View File

@ -71,7 +71,7 @@ class BaseView extends View
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;