oms-Tag/tests/Models/TagTest.php
2020-08-31 22:30:36 +02:00

77 lines
1.7 KiB
PHP

<?php
/**
* Orange Management
*
* PHP Version 7.4
*
* @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\Tag\tests\Models;
use Modules\Admin\Models\NullAccount;
use Modules\Tag\Models\Tag;
use Modules\Tag\Models\TagType;
/**
* @internal
*/
class TagTest extends \PHPUnit\Framework\TestCase
{
public function testDefault() : void
{
$tag = new Tag();
self::assertEquals(0, $tag->getId());
self::assertInstanceOf(NullAccount::class, $tag->getOwner());
self::assertEquals(TagType::SINGLE, $tag->getType());
self::assertEquals('00000000', $tag->getColor());
self::assertEquals('', $tag->getTitle());
self::assertEquals(
[
'id' => 0,
'title' => '',
'color' => '00000000',
],
$tag->toArray()
);
self::assertEquals(
[
'id' => 0,
'title' => '',
'color' => '00000000',
],
$tag->jsonSerialize()
);
}
public function testTitleInputOutput() : void
{
$tag = new Tag();
$tag->setTitle('Test');
self::assertEquals('Test', $tag->getTitle());
}
public function testColorInputOutput() : void
{
$tag = new Tag();
$tag->setColor('ffffffff');
self::assertEquals('ffffffff', $tag->getColor());
}
public function testTypeInputOutput() : void
{
$tag = new Tag();
$tag->setType(TagType::SHARED);
self::assertEquals(TagType::SHARED, $tag->getType());
}
}