mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-25 14:16:10 +01:00
TASK: Add new test covering new feature
This commit is contained in:
parent
e3151e802c
commit
5ba860b8de
1 changed files with 48 additions and 1 deletions
|
@ -359,6 +359,54 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function configuredQueryFieldsAreAddedToQuery()
|
||||
{
|
||||
$searchRequest = new SearchRequest('SearchWord');
|
||||
|
||||
$this->configuration->expects($this->any())
|
||||
->method('get')
|
||||
->withConsecutive(
|
||||
['searching.fields.query'],
|
||||
['searching.boost'],
|
||||
['searching.fields.stored_fields'],
|
||||
['searching.fields.script_fields'],
|
||||
['searching.fieldValueFactor']
|
||||
)
|
||||
->will($this->onConsecutiveCalls(
|
||||
'_all, field1, field2',
|
||||
$this->throwException(new InvalidArgumentException),
|
||||
$this->throwException(new InvalidArgumentException),
|
||||
$this->throwException(new InvalidArgumentException),
|
||||
$this->throwException(new InvalidArgumentException)
|
||||
));
|
||||
|
||||
$query = $this->subject->create($searchRequest);
|
||||
$this->assertArraySubset(
|
||||
[
|
||||
'bool' => [
|
||||
'must' => [
|
||||
[
|
||||
'multi_match' => [
|
||||
'type' => 'most_fields',
|
||||
'query' => 'SearchWord',
|
||||
'fields' => [
|
||||
'_all',
|
||||
'field1',
|
||||
'field2',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
$query->toArray()['query'],
|
||||
'Configured fields were not added to query as configured.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
@ -462,7 +510,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
|||
$query->toArray()['script_fields'],
|
||||
'Script fields were not added to query as expected.'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue