mirror of
https://github.com/werkraum-media/events.git
synced 2024-12-23 12:06:09 +01:00
Daniel Siepmann
27ee70d0cf
A new PSR-14 event is added that allows to modify the categories to be assigned to an event. The event itself (including already existing categories) as well as the list of categories to be used after import are available. It is possible to change the categories to be assigned, e.g. keep some of the existing categories. That way it is possible for installations to add custom categories to events. Relates: #10623
63 lines
1.3 KiB
PHP
63 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Wrm\Events\Tests\Unit\Domain\Model;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
|
|
use Wrm\Events\Domain\Model\Category;
|
|
use Wrm\Events\Domain\Model\Event;
|
|
|
|
/**
|
|
* @covers \Wrm\Events\Domain\Model\Event
|
|
*/
|
|
class EventTest extends TestCase
|
|
{
|
|
/**
|
|
* @test
|
|
*/
|
|
public function canBeCreated(): void
|
|
{
|
|
$subject = new Event();
|
|
|
|
self::assertInstanceOf(
|
|
Event::class,
|
|
$subject
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function returnsSortedFeatures(): void
|
|
{
|
|
$feature1 = $this->createStub(Category::class);
|
|
$feature1->method('getSorting')->willReturn(10);
|
|
$feature2 = $this->createStub(Category::class);
|
|
$feature2->method('getSorting')->willReturn(5);
|
|
|
|
$storage = new ObjectStorage();
|
|
$storage->attach($feature1);
|
|
$storage->attach($feature2);
|
|
|
|
$subject = new Event();
|
|
$subject->setFeatures($storage);
|
|
|
|
self::assertSame([
|
|
$feature2,
|
|
$feature1,
|
|
], $subject->getFeatures());
|
|
}
|
|
|
|
/**
|
|
* @test
|
|
*/
|
|
public function returnsEmptyFeaturesStorage(): void
|
|
{
|
|
$subject = new Event();
|
|
$subject->setFeatures(new ObjectStorage());
|
|
|
|
self::assertSame([], $subject->getFeatures());
|
|
}
|
|
}
|