Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose settings via DateSearchVariables Event #57

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Classes/Controller/DateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public function searchAction(array $search = []): void
}

$event = $this->eventDispatcher->dispatch(new DateSearchVariables(
$this->settings,
$search,
$demand,
$this->regionRepository->findAll(),
Expand Down
12 changes: 12 additions & 0 deletions Classes/Events/Controller/DateSearchVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@

class DateSearchVariables
{
/**
* @var array
*/
private $settings;

/**
* @var array
*/
Expand Down Expand Up @@ -43,19 +48,26 @@ 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;
$this->categories = $categories;
$this->features = $features;
}

public function getSettings(): array
{
return $this->settings;
}

public function getSearch(): array
{
return $this->search;
Expand Down
27 changes: 27 additions & 0 deletions Documentation/Changelog/3.8.0.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
3.8.0
=====

Breaking
--------

Nothing

Features
--------

* Expose settings via `DateSearchVariables` Event.

Fixes
-----

Nothing

Tasks
-----

Nothing

Deprecation
-----------

Nothing
43 changes: 43 additions & 0 deletions Tests/Unit/Events/Controller/DateSearchVariablesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class DateSearchVariablesTest extends TestCase
public function canBeCreated(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
Expand All @@ -37,12 +39,39 @@ public function canBeCreated(): void
);
}

/**
* @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',
],
Expand All @@ -67,6 +96,8 @@ public function returnsInitializeDemand(): void
{
$demand = new DateDemand();
$subject = new DateSearchVariables(
[
],
[
],
$demand,
Expand All @@ -88,6 +119,8 @@ public function returnsInitialRegions(): void
{
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
Expand All @@ -108,6 +141,8 @@ public function returnsInitialRegions(): void
public function returnsInitialCategories(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
Expand All @@ -132,6 +167,8 @@ public function returnsInitialCategories(): void
public function returnsInitialFeatures(): void
{
$subject = new DateSearchVariables(
[
],
[
],
new DateDemand(),
Expand Down Expand Up @@ -159,6 +196,8 @@ public function returnsInitialVariablesForView(): void
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
Expand Down Expand Up @@ -198,6 +237,8 @@ public function returnsVariablesForViewWithAddedVariables(): void
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
Expand Down Expand Up @@ -242,6 +283,8 @@ public function returnsVariablesForViewWithOverwrittenVariables(): void
$demand = new DateDemand();
$regions = $this->prophesize(QueryResult::class)->reveal();
$subject = new DateSearchVariables(
[
],
[
'executed' => '1',
],
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
'state' => 'stable',
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '3.7.0',
'version' => '3.8.0',
'constraints' => [
'depends' => [
'typo3' => '10.4.00-11.5.99',
Expand Down
Loading