2022-07-05 14:08:14 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2023-11-09 10:27:43 +01:00
|
|
|
namespace WerkraumMedia\Events\Tests\Unit\Domain\Model;
|
2022-07-05 14:08:14 +02:00
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
use PHPUnit\Framework\Attributes\Test;
|
2022-07-05 14:08:14 +02:00
|
|
|
use PHPUnit\Framework\TestCase;
|
2023-11-09 10:27:43 +01:00
|
|
|
use WerkraumMedia\Events\Domain\Model\Category;
|
2022-07-05 14:08:14 +02:00
|
|
|
|
|
|
|
class CategoryTest extends TestCase
|
|
|
|
{
|
2023-11-27 10:04:42 +01:00
|
|
|
#[Test]
|
2022-07-05 14:08:14 +02:00
|
|
|
public function canBeCreated(): void
|
|
|
|
{
|
2023-08-14 12:09:28 +02:00
|
|
|
$subject = new Category(
|
|
|
|
null,
|
|
|
|
10,
|
|
|
|
'Title',
|
|
|
|
false
|
|
|
|
);
|
2022-07-05 14:08:14 +02:00
|
|
|
|
|
|
|
self::assertInstanceOf(
|
|
|
|
Category::class,
|
|
|
|
$subject
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
#[Test]
|
2022-07-05 14:08:14 +02:00
|
|
|
public function returnsSorting(): void
|
|
|
|
{
|
2023-08-14 12:09:28 +02:00
|
|
|
$subject = new Category(
|
|
|
|
null,
|
|
|
|
10,
|
|
|
|
'Title',
|
|
|
|
false
|
|
|
|
);
|
2022-07-05 14:08:14 +02:00
|
|
|
$subject->_setProperty('sorting', 10);
|
|
|
|
|
|
|
|
self::assertSame(10, $subject->getSorting());
|
|
|
|
}
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
#[Test]
|
2023-08-14 12:09:28 +02:00
|
|
|
public function canBeVisible(): void
|
2022-07-05 14:08:14 +02:00
|
|
|
{
|
2023-08-14 12:09:28 +02:00
|
|
|
$subject = new Category(
|
|
|
|
null,
|
|
|
|
10,
|
|
|
|
'Title',
|
|
|
|
false
|
|
|
|
);
|
2022-07-05 14:08:14 +02:00
|
|
|
|
|
|
|
self::assertFalse($subject->_getProperty('hidden'));
|
2023-08-14 12:09:28 +02:00
|
|
|
}
|
|
|
|
|
2023-11-27 10:04:42 +01:00
|
|
|
#[Test]
|
2023-08-14 12:09:28 +02:00
|
|
|
public function canHide(): void
|
|
|
|
{
|
|
|
|
$subject = new Category(
|
|
|
|
null,
|
|
|
|
10,
|
|
|
|
'Title',
|
|
|
|
true
|
|
|
|
);
|
2022-07-05 14:08:14 +02:00
|
|
|
|
|
|
|
self::assertTrue($subject->_getProperty('hidden'));
|
|
|
|
}
|
|
|
|
}
|