oms-ContractManagement/tests/Models/ContractTest.php
Dennis Eichhorn dcb030febd
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:04 +00:00

70 lines
1.7 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\ContractManagement\tests\Models;
use Modules\ContractManagement\Models\Contract;
/**
* @internal
*/
#[\PHPUnit\Framework\Attributes\CoversClass(\Modules\ContractManagement\Models\Contract::class)]
final class ContractTest extends \PHPUnit\Framework\TestCase
{
private Contract $contract;
/**
* {@inheritdoc}
*/
protected function setUp() : void
{
$this->contract = new Contract();
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testDefault() : void
{
self::assertEquals(0, $this->contract->id);
self::assertEquals([], $this->contract->files);
}
#[\PHPUnit\Framework\Attributes\Group('module')]
public function testSerialize() : void
{
$this->contract->title = 'Title';
$this->contract->description = 'Description';
$this->contract->duration = 123;
$this->contract->warning = 2;
$serialized = $this->contract->jsonSerialize();
unset($serialized['createdAt']);
self::assertEquals(
[
'id' => 0,
'title' => 'Title',
'description' => 'Description',
'start' => null,
'end' => null,
'duration' => 123,
'warning' => 2,
'responsible' => null,
'costs' => null,
'type' => null,
],
$serialized
);
}
}