Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Eichhorn committed Sep 22, 2023
1 parent 0af8511 commit 780deb4
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@
Autoloader::addPath(__DIR__ . '/../Resources');

/** @var \phpOMS\Views\View $this */
/** @var \Modules\Media\Models\Collection $media */
$media = $this->getData('media');

Check failure on line 25 in Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php

View workflow job for this annotation

GitHub Actions / static-tests (8.1)

PHPDoc tag @var for variable $media contains unknown class Modules\Media\Models\Collection.
$data = $this->getData('data') ?? [];

/** @var array $data */
$data = $this->getData('data') ?? [];

include $media->getSourceByName('template.php')->getAbsolutePath();

Check failure on line 30 in Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php

View workflow job for this annotation

GitHub Actions / static-tests (8.1)

Call to method getSourceByName() on an unknown class Modules\Media\Models\Collection.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<array> $data */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<array> $data */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
16 changes: 10 additions & 6 deletions Controller/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
),
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Models/AccountCredentialMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @since 1.0.0
*
* @template T of Account
* @extends AccountMapper<T>
* @extends AccountMapper<Account>
*/
final class AccountCredentialMapper extends AccountMapper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 780deb4

Please sign in to comment.