mirror of
https://github.com/werkraum-media/events.git
synced 2024-11-15 02:36:10 +01:00
129 lines
2.6 KiB
PHP
129 lines
2.6 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Wrm\Events\Tests\Unit\Domain\Model\Dto;
|
||
|
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
use Wrm\Events\Domain\Model\Dto\DateDemand;
|
||
|
|
||
|
/**
|
||
|
* @covers \Wrm\Events\Domain\Model\Dto\DateDemand
|
||
|
*/
|
||
|
class DateDemandTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function canBeCreated(): void
|
||
|
{
|
||
|
$subject = new DateDemand();
|
||
|
|
||
|
self::assertInstanceOf(
|
||
|
DateDemand::class,
|
||
|
$subject
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function searchWordIsSetByRequest(): void
|
||
|
{
|
||
|
$result = DateDemand::createFromRequestValues(
|
||
|
[
|
||
|
'searchword' => 'This is the search word',
|
||
|
],
|
||
|
[
|
||
|
]
|
||
|
);
|
||
|
|
||
|
self::assertSame(
|
||
|
'This is the search word',
|
||
|
$result->getSearchword()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function synonymsAreSetBySettings(): void
|
||
|
{
|
||
|
$result = DateDemand::createFromRequestValues(
|
||
|
[
|
||
|
'searchword' => 'synonym1',
|
||
|
],
|
||
|
[
|
||
|
'synonyms' => [
|
||
|
[
|
||
|
'word' => 'Word1',
|
||
|
'synonyms' => 'synonym1, synonym2',
|
||
|
],
|
||
|
[
|
||
|
'word' => 'Word2',
|
||
|
'synonyms' => 'synonym3, synonym4',
|
||
|
],
|
||
|
[
|
||
|
'word' => 'Word3',
|
||
|
'synonyms' => 'synonym1',
|
||
|
],
|
||
|
],
|
||
|
]
|
||
|
);
|
||
|
|
||
|
self::assertSame(
|
||
|
[
|
||
|
'Word1',
|
||
|
'Word3',
|
||
|
],
|
||
|
$result->getSynonymsForSearchword()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function categoriesAreSetByRequest(): void
|
||
|
{
|
||
|
$result = DateDemand::createFromRequestValues(
|
||
|
[
|
||
|
'userCategories' => [
|
||
|
'10', '20',
|
||
|
],
|
||
|
],
|
||
|
[
|
||
|
]
|
||
|
);
|
||
|
|
||
|
self::assertSame(
|
||
|
[
|
||
|
10,
|
||
|
20,
|
||
|
],
|
||
|
$result->getUserCategories()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @test
|
||
|
*/
|
||
|
public function regionsAreSetByRequest(): void
|
||
|
{
|
||
|
$result = DateDemand::createFromRequestValues(
|
||
|
[
|
||
|
'regions' => [
|
||
|
'10', '20',
|
||
|
],
|
||
|
],
|
||
|
[
|
||
|
]
|
||
|
);
|
||
|
|
||
|
self::assertSame(
|
||
|
[
|
||
|
10,
|
||
|
20,
|
||
|
],
|
||
|
$result->getRegions()
|
||
|
);
|
||
|
}
|
||
|
}
|