oms-HumanResourceManagement/tests/Models/EmployeeHistoryTest.php
Dennis Eichhorn daad2cd4a6
Some checks failed
Image optimization / general_image_workflow (push) Has been cancelled
CI / general_module_workflow_php (push) Has been cancelled
CI / general_module_workflow_js (push) Has been cancelled
fix permissions
2025-04-02 14:15:05 +00:00

69 lines
2.0 KiB
PHP

<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.2
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\HumanResourceManagement\tests\Models;
use Modules\HumanResourceManagement\Models\EmployeeHistory;
use Modules\HumanResourceManagement\Models\NullEmployee;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\HumanResourceManagement\Models\EmployeeHistory::class)]
final class EmployeeHistoryTest extends \PHPUnit\Framework\TestCase
{
private EmployeeHistory $history;
/**
* {@inheritdoc}
*/
protected function setUp() : void
{
$this->history = new EmployeeHistory();
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->history->id);
self::assertNull($this->history->end);
self::assertInstanceOf('\Modules\HumanResourceManagement\Models\Employee', $this->history->employee);
self::assertInstanceOf('\Modules\Organization\Models\NullPosition', $this->history->position);
self::assertInstanceOf('\Modules\Organization\Models\NullUnit', $this->history->unit);
self::assertInstanceOf('\Modules\Organization\Models\NullDepartment', $this->history->department);
self::assertInstanceOf('\DateTime', $this->history->start);
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->history->employee = new NullEmployee(2);
$serialized = $this->history->jsonSerialize();
unset($serialized['start']);
unset($serialized['unit']);
unset($serialized['department']);
unset($serialized['position']);
self::assertEquals(
[
'id' => 0,
'employee' => 2,
'end' => null,
],
$serialized
);
}
}