mirror of
https://github.com/Karaka-Management/oms-ClientManagement.git
synced 2026-01-11 15:28:41 +00:00
83 lines
2.1 KiB
PHP
83 lines
2.1 KiB
PHP
<?php
|
|
/**
|
|
* Orange Management
|
|
*
|
|
* PHP Version 8.0
|
|
*
|
|
* @package tests
|
|
* @copyright Dennis Eichhorn
|
|
* @license OMS License 1.0
|
|
* @version 1.0.0
|
|
* @link https://orange-management.org
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\ClientManagement\tests\Models;
|
|
|
|
use Modules\ClientManagement\Models\ClientAttributeType;
|
|
use Modules\ClientManagement\Models\ClientAttributeTypeL11n;
|
|
|
|
/**
|
|
* @internal
|
|
*/
|
|
final class ClientAttributeTypeTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
private ClientAttributeType $type;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function setUp() : void
|
|
{
|
|
$this->type = new ClientAttributeType();
|
|
}
|
|
|
|
/**
|
|
* @covers Modules\ClientManagement\Models\ClientAttributeType
|
|
* @group module
|
|
*/
|
|
public function testDefault() : void
|
|
{
|
|
self::assertEquals(0, $this->type->getId());
|
|
self::assertEquals('', $this->type->getL11n());
|
|
}
|
|
|
|
/**
|
|
* @covers Modules\ClientManagement\Models\ClientAttributeType
|
|
* @group module
|
|
*/
|
|
public function testL11nInputOutput() : void
|
|
{
|
|
$this->type->setL11n('Test');
|
|
self::assertEquals('Test', $this->type->getL11n());
|
|
|
|
$this->type->setL11n(new ClientAttributeTypeL11n(0, 'NewTest'));
|
|
self::assertEquals('NewTest', $this->type->getL11n());
|
|
}
|
|
|
|
/**
|
|
* @covers Modules\ClientManagement\Models\ClientAttributeType
|
|
* @group module
|
|
*/
|
|
public function testSerialize() : void
|
|
{
|
|
$this->type->name = 'Title';
|
|
$this->type->fields = 2;
|
|
$this->type->custom = true;
|
|
$this->type->validationPattern = '\d*';
|
|
$this->type->isRequired = true;
|
|
|
|
self::assertEquals(
|
|
[
|
|
'id' => 0,
|
|
'name' => 'Title',
|
|
'fields' => 2,
|
|
'custom' => true,
|
|
'validationPattern' => '\d*',
|
|
'isRequired' => true,
|
|
],
|
|
$this->type->jsonSerialize()
|
|
);
|
|
}
|
|
}
|