From 9dae632c56ae6ff56515a52552dfbf65b1007661 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Thu, 25 Apr 2024 13:34:46 +0000 Subject: [PATCH] fix tests --- Controller/BackendController.php | 2 ++ tests/Controller/ApiControllerTest.php | 2 +- tests/Models/EmployeeHistoryTest.php | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 19632b9..960fdb5 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -219,6 +219,7 @@ final class BackendController extends Controller ->where('unit', $this->app->unitId) ->executeGetArray(); + /** @var \Modules\HumanResourceManagement\Models\EmployeeHistory[] $histories */ $histories = EmployeeHistoryMapper::getAll() ->where('department', \array_map(function (Department $department) : int { return $department->id; }, $view->data['departments'])) ->where('unit', $this->app->unitId) @@ -360,6 +361,7 @@ final class BackendController extends Controller ->where('department', \array_map(function (Department $department) : int { return $department->id; }, $departments)) ->executeGetArray(); + /** @var \Modules\HumanResourceManagement\Models\EmployeeHistory[] $histories */ $histories = EmployeeHistoryMapper::getAll() ->where('department', \array_map(function (Department $department) : int { return $department->id; }, $departments)) ->where('position', \array_map(function (Position $position) : int { return $position->id; }, $view->data['positions'])) diff --git a/tests/Controller/ApiControllerTest.php b/tests/Controller/ApiControllerTest.php index 221d023..2d9513c 100755 --- a/tests/Controller/ApiControllerTest.php +++ b/tests/Controller/ApiControllerTest.php @@ -53,7 +53,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase */ protected ModuleAbstract $module; - protected static int $employee = 0; + protected static mixed $employee = 0; public static function setUpBeforeClass() : void { diff --git a/tests/Models/EmployeeHistoryTest.php b/tests/Models/EmployeeHistoryTest.php index 5f12763..754efd5 100644 --- a/tests/Models/EmployeeHistoryTest.php +++ b/tests/Models/EmployeeHistoryTest.php @@ -15,6 +15,7 @@ declare(strict_types=1); namespace Modules\HumanResourceManagement\tests\Models; use Modules\HumanResourceManagement\Models\EmployeeHistory; +use Modules\HumanResourceManagement\Models\NullEmployee; /** * @internal @@ -47,7 +48,7 @@ final class EmployeeHistoryTest extends \PHPUnit\Framework\TestCase #[\PHPUnit\Framework\Attributes\Group('module')] public function testSerialize() : void { - $this->history->employee = 2; + $this->history->employee = new NullEmployee(2); $serialized = $this->history->jsonSerialize(); unset($serialized['start']);