mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 02:16:11 +01:00
BUGFIX: Keep existing arguments in filter mode
E.g. to support paginate widget arguments.
This commit is contained in:
parent
0dd65085b6
commit
306f5bef84
2 changed files with 35 additions and 3 deletions
|
@ -49,9 +49,12 @@ class SearchController extends ActionController
|
||||||
if (isset($this->settings['searching']['mode']) && $this->settings['searching']['mode'] === 'filter'
|
if (isset($this->settings['searching']['mode']) && $this->settings['searching']['mode'] === 'filter'
|
||||||
&& $this->request->hasArgument('searchRequest') === false
|
&& $this->request->hasArgument('searchRequest') === false
|
||||||
) {
|
) {
|
||||||
$this->request->setArguments([
|
$this->request->setArguments(array_merge(
|
||||||
'searchRequest' => $this->objectManager->get(SearchRequest::class),
|
$this->request->getArguments(),
|
||||||
]);
|
[
|
||||||
|
'searchRequest' => $this->objectManager->get(SearchRequest::class),
|
||||||
|
]
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,6 +83,35 @@ class SearchControllerTest extends AbstractUnitTestCase
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
*/
|
||||||
|
public function searchRequestArgumentIsAddedToExistingArguments()
|
||||||
|
{
|
||||||
|
$this->request->setArguments([
|
||||||
|
'@widget_0' => [
|
||||||
|
'currentPage' => '7',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
$this->inject($this->subject, 'settings', [
|
||||||
|
'searching' => [
|
||||||
|
'mode' => 'filter',
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->subject->initializeSearchAction();
|
||||||
|
$this->assertInstanceOf(
|
||||||
|
SearchRequest::class,
|
||||||
|
$this->request->getArgument('searchRequest'),
|
||||||
|
'Search request was not created.'
|
||||||
|
);
|
||||||
|
$this->assertSame(
|
||||||
|
['currentPage' => '7'],
|
||||||
|
$this->request->getArgument('@widget_0'),
|
||||||
|
'Existing arguments were not kept.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue