mirror of
https://github.com/Karaka-Management/oms-Attribute.git
synced 2026-02-17 09:58:50 +00:00
test fixes
This commit is contained in:
parent
39ed9367a6
commit
5e3939426a
72
tests/Models/AttributeTest.php
Normal file
72
tests/Models/AttributeTest.php
Normal file
|
|
@ -0,0 +1,72 @@
|
||||||
|
<?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\Admin\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\Attribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @testdox Modules\Admin\tests\Models\AttributeTest: Attribute model
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class AttributeTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
public function testDeepClone() : void
|
||||||
|
{
|
||||||
|
$attr = new Attribute();
|
||||||
|
|
||||||
|
$clone = $attr->deepClone();
|
||||||
|
|
||||||
|
$attr->ref = 1;
|
||||||
|
|
||||||
|
self::assertNotEquals($attr->ref, $clone->ref);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testToArray() : void
|
||||||
|
{
|
||||||
|
$attr = new Attribute();
|
||||||
|
|
||||||
|
$array = $attr->toArray();
|
||||||
|
|
||||||
|
unset($array['type']);
|
||||||
|
unset($array['value']);
|
||||||
|
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'ref' => 0,
|
||||||
|
],
|
||||||
|
$array
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testJsonSerialize() : void
|
||||||
|
{
|
||||||
|
$attr = new Attribute();
|
||||||
|
|
||||||
|
$array = $attr->jsonSerialize();
|
||||||
|
|
||||||
|
unset($array['type']);
|
||||||
|
unset($array['value']);
|
||||||
|
|
||||||
|
self::assertEquals(
|
||||||
|
[
|
||||||
|
'id' => 0,
|
||||||
|
'ref' => 0,
|
||||||
|
],
|
||||||
|
$array
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/Models/NullAttributeTest.php
Normal file
52
tests/Models/NullAttributeTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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\Attribute\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\NullAttribute;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class NullAttributeTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttribute
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testNull() : void
|
||||||
|
{
|
||||||
|
self::assertInstanceOf('\Modules\Attribute\Models\Attribute', new NullAttribute());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttribute
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testId() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttribute(2);
|
||||||
|
self::assertEquals(2, $null->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttribute
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testJsonSerialize() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttribute(2);
|
||||||
|
self::assertEquals(['id' => 2], $null);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/Models/NullAttributeTypeTest.php
Normal file
52
tests/Models/NullAttributeTypeTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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\Attribute\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\NullAttributeType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class NullAttributeTypeTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeType
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testNull() : void
|
||||||
|
{
|
||||||
|
self::assertInstanceOf('\Modules\Attribute\Models\AttributeType', new NullAttributeType());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeType
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testId() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttributeType(2);
|
||||||
|
self::assertEquals(2, $null->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeType
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testJsonSerialize() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttributeType(2);
|
||||||
|
self::assertEquals(['id' => 2], $null);
|
||||||
|
}
|
||||||
|
}
|
||||||
52
tests/Models/NullAttributeValueTest.php
Normal file
52
tests/Models/NullAttributeValueTest.php
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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\Attribute\tests\Models;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\NullAttributeValue;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
final class NullAttributeValueTest extends \PHPUnit\Framework\TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeValue
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testNull() : void
|
||||||
|
{
|
||||||
|
self::assertInstanceOf('\Modules\Attribute\Models\AttributeValue', new NullAttributeValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeValue
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testId() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttributeValue(2);
|
||||||
|
self::assertEquals(2, $null->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers Modules\Attribute\Models\NullAttributeValue
|
||||||
|
* @group module
|
||||||
|
*/
|
||||||
|
public function testJsonSerialize() : void
|
||||||
|
{
|
||||||
|
$null = new NullAttributeValue(2);
|
||||||
|
self::assertEquals(['id' => 2], $null);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user