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( $event = $this->eventDispatcher->dispatch(new DateSearchVariables(
$this->settings,
$search, $search,
$demand, $demand,
$this->regionRepository->findAll(), $this->regionRepository->findAll(),

View file

@ -9,6 +9,11 @@ use Wrm\Events\Domain\Model\Region;
class DateSearchVariables class DateSearchVariables
{ {
/**
* @var array
*/
private $settings;
/** /**
* @var array * @var array
*/ */
@ -43,12 +48,14 @@ class DateSearchVariables
* @param QueryResultInterface<Region> $regions * @param QueryResultInterface<Region> $regions
*/ */
public function __construct( public function __construct(
array $settings,
array $search, array $search,
DateDemand $demand, DateDemand $demand,
QueryResultInterface $regions, QueryResultInterface $regions,
array $categories, array $categories,
array $features array $features
) { ) {
$this->settings = $settings;
$this->search = $search; $this->search = $search;
$this->demand = $demand; $this->demand = $demand;
$this->regions = $regions; $this->regions = $regions;
@ -56,6 +63,11 @@ class DateSearchVariables
$this->features = $features; $this->features = $features;
} }
public function getSettings(): array
{
return $this->settings;
}
public function getSearch(): array public function getSearch(): array
{ {
return $this->search; 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 public function canBeCreated(): void
{ {
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
], ],
new DateDemand(), 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 * @test
*/ */
public function returnsInitializeSearch(): void public function returnsInitializeSearch(): void
{ {
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
'executed' => '1', 'executed' => '1',
], ],
@ -67,6 +96,8 @@ class DateSearchVariablesTest extends TestCase
{ {
$demand = new DateDemand(); $demand = new DateDemand();
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
], ],
$demand, $demand,
@ -88,6 +119,8 @@ class DateSearchVariablesTest extends TestCase
{ {
$regions = $this->prophesize(QueryResult::class)->reveal(); $regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
], ],
new DateDemand(), new DateDemand(),
@ -108,6 +141,8 @@ class DateSearchVariablesTest extends TestCase
public function returnsInitialCategories(): void public function returnsInitialCategories(): void
{ {
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
], ],
new DateDemand(), new DateDemand(),
@ -132,6 +167,8 @@ class DateSearchVariablesTest extends TestCase
public function returnsInitialFeatures(): void public function returnsInitialFeatures(): void
{ {
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
], ],
new DateDemand(), new DateDemand(),
@ -159,6 +196,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand(); $demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal(); $regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
'executed' => '1', 'executed' => '1',
], ],
@ -198,6 +237,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand(); $demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal(); $regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
'executed' => '1', 'executed' => '1',
], ],
@ -242,6 +283,8 @@ class DateSearchVariablesTest extends TestCase
$demand = new DateDemand(); $demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal(); $regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables( $subject = new DateSearchVariables(
[
],
[ [
'executed' => '1', 'executed' => '1',
], ],

View file

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