Expose settings via DateSearchVariables Event (#57)

This commit is contained in:
Daniel Siepmann 2024-06-27 10:09:29 +02:00 committed by GitHub
parent 9498fec755
commit 275dc3ffc1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 84 additions and 1 deletions

View file

@ -133,6 +133,7 @@ class DateController extends AbstractController
}
$event = $this->eventDispatcher->dispatch(new DateSearchVariables(
$this->settings,
$search,
$demand,
$this->regionRepository->findAll(),

View file

@ -9,6 +9,11 @@ use Wrm\Events\Domain\Model\Region;
class DateSearchVariables
{
/**
* @var array
*/
private $settings;
/**
* @var array
*/
@ -43,12 +48,14 @@ class DateSearchVariables
* @param QueryResultInterface<Region> $regions
*/
public function __construct(
array $settings,
array $search,
DateDemand $demand,
QueryResultInterface $regions,
array $categories,
array $features
) {
$this->settings = $settings;
$this->search = $search;
$this->demand = $demand;
$this->regions = $regions;
@ -56,6 +63,11 @@ class DateSearchVariables
$this->features = $features;
}
public function getSettings(): array
{
return $this->settings;
}
public function getSearch(): array
{
return $this->search;

View file

@ -0,0 +1,27 @@
3.8.0
=====
Breaking
--------
Nothing
Features
--------
* Expose settings via `DateSearchVariables` Event.
Fixes
-----
Nothing
Tasks
-----
Nothing
Deprecation
-----------
Nothing

View file

@ -23,6 +23,8 @@ class DateSearchVariablesTest extends TestCase
public function canBeCreated(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
@ -37,12 +39,39 @@ class DateSearchVariablesTest extends TestCase
);
}
/**
* @test
*/
public function returnsInitializeSettings(): void
{
$subject = new DateSearchVariables(
[
'someCustomKey' => 'someCustomValue',
],
[
],
new DateDemand(),
$this->prophesize(QueryResult::class)->reveal(),
[],
[]
);
self::assertSame(
[
'someCustomKey' => 'someCustomValue',
],
$subject->getSettings()
);
}
/**
* @test
*/
public function returnsInitializeSearch(): void
{
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
@ -67,6 +96,8 @@ class DateSearchVariablesTest extends TestCase
{
$demand = new DateDemand();
$subject = new DateSearchVariables(
[
],
[
],
$demand,
@ -88,6 +119,8 @@ class DateSearchVariablesTest extends TestCase
{
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
@ -108,6 +141,8 @@ class DateSearchVariablesTest extends TestCase
public function returnsInitialCategories(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
@ -132,6 +167,8 @@ class DateSearchVariablesTest extends TestCase
public function returnsInitialFeatures(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
@ -159,6 +196,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
@ -198,6 +237,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
@ -242,6 +283,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],

View file

@ -9,7 +9,7 @@ $EM_CONF['events'] = [
'state' => 'stable',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '3.7.0',
'version' => '3.8.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.00-11.5.99',