oms-RiskManagement/tests/Models/DepartmentMapperTest.php
2024-03-20 05:16:00 +00:00

43 lines
1.2 KiB
PHP
Executable File

<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\RiskManagement\tests\Models;
use Modules\Organization\Models\NullDepartment;
use Modules\RiskManagement\Models\Department;
use Modules\RiskManagement\Models\DepartmentMapper;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\RiskManagement\Models\DepartmentMapper::class)]
final class DepartmentMapperTest extends \PHPUnit\Framework\TestCase
{
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testCRUD() : void
{
$obj = new Department();
$obj->department = new NullDepartment();
$obj->responsible = 1;
$obj->deputy = 1;
DepartmentMapper::create()->execute($obj);
$objR = DepartmentMapper::get()->where('id', $obj->id)->execute();
self::assertEquals($obj->department->id, $objR->department->id);
self::assertEquals($obj->responsible, $objR->responsible);
self::assertEquals($obj->deputy, $objR->deputy);
}
}