1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Searching: Fixed some form search issues

- Form was not retaining certain filters
- Form request handling of entity type set wrong filter name
Added test to cover.
This commit is contained in:
Dan Brown
2024-10-05 14:47:00 +01:00
parent c314a60a16
commit 51287d545b
3 changed files with 20 additions and 4 deletions

View File

@ -113,6 +113,19 @@ class SearchOptionsTest extends TestCase
$this->assertEquals(['"cheese"', '""', '"baked', 'beans"'], $options->exacts->toValueArray());
}
public function test_from_request_properly_parses_provided_types()
{
$request = new Request([
'search' => '',
'types' => ['page', 'book'],
]);
$options = SearchOptions::fromRequest($request);
$filters = $options->filters->toValueMap();
$this->assertCount(1, $filters);
$this->assertEquals('page|book', $filters['type'] ?? 'notfound');
}
public function test_from_request_properly_parses_out_extras_as_string()
{
$request = new Request([