mirror of
https://github.com/Codappix/search_core.git
synced 2024-11-22 14:56:12 +01:00
TASK: Fix broken tests for query factory
This commit is contained in:
parent
7a5bea687e
commit
85bfb86f5f
1 changed files with 27 additions and 9 deletions
|
@ -100,8 +100,6 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
||||||
$searchRequest = new SearchRequest('SearchWord');
|
$searchRequest = new SearchRequest('SearchWord');
|
||||||
$searchRequest->setFilter([
|
$searchRequest->setFilter([
|
||||||
'field' => '',
|
'field' => '',
|
||||||
'field1' => 0,
|
|
||||||
'field2' => false,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertFalse(
|
$this->assertFalse(
|
||||||
|
@ -209,10 +207,16 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
||||||
public function minimumShouldMatchIsAddedToQuery()
|
public function minimumShouldMatchIsAddedToQuery()
|
||||||
{
|
{
|
||||||
$searchRequest = new SearchRequest('SearchWord');
|
$searchRequest = new SearchRequest('SearchWord');
|
||||||
$this->configuration->expects($this->once())
|
$this->configuration->expects($this->any())
|
||||||
->method('getIfExists')
|
->method('getIfExists')
|
||||||
->with('searching.minimumShouldMatch')
|
->withConsecutive(
|
||||||
->willReturn('50%');
|
['searching.minimumShouldMatch'],
|
||||||
|
['searching.sort']
|
||||||
|
)
|
||||||
|
->will($this->onConsecutiveCalls(
|
||||||
|
'50%',
|
||||||
|
null
|
||||||
|
));
|
||||||
$this->configuration->expects($this->any())
|
$this->configuration->expects($this->any())
|
||||||
->method('get')
|
->method('get')
|
||||||
->will($this->throwException(new InvalidArgumentException));
|
->will($this->throwException(new InvalidArgumentException));
|
||||||
|
@ -244,14 +248,21 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
||||||
{
|
{
|
||||||
$searchRequest = new SearchRequest('SearchWord');
|
$searchRequest = new SearchRequest('SearchWord');
|
||||||
|
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->any())
|
||||||
->method('get')
|
->method('get')
|
||||||
->withConsecutive(['searching.boost'], ['searching.fieldValueFactor'])
|
->withConsecutive(
|
||||||
|
['searching.boost'],
|
||||||
|
['searching.fields.stored_fields'],
|
||||||
|
['searching.fields.script_fields'],
|
||||||
|
['searching.fieldValueFactor']
|
||||||
|
)
|
||||||
->will($this->onConsecutiveCalls(
|
->will($this->onConsecutiveCalls(
|
||||||
[
|
[
|
||||||
'search_title' => 3,
|
'search_title' => 3,
|
||||||
'search_abstract' => 1.5,
|
'search_abstract' => 1.5,
|
||||||
],
|
],
|
||||||
|
$this->throwException(new InvalidArgumentException),
|
||||||
|
$this->throwException(new InvalidArgumentException),
|
||||||
$this->throwException(new InvalidArgumentException)
|
$this->throwException(new InvalidArgumentException)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -292,10 +303,17 @@ class QueryFactoryTest extends AbstractUnitTestCase
|
||||||
'factor' => '2',
|
'factor' => '2',
|
||||||
'missing' => '1',
|
'missing' => '1',
|
||||||
];
|
];
|
||||||
$this->configuration->expects($this->exactly(2))
|
$this->configuration->expects($this->any())
|
||||||
->method('get')
|
->method('get')
|
||||||
->withConsecutive(['searching.boost'], ['searching.fieldValueFactor'])
|
->withConsecutive(
|
||||||
|
['searching.boost'],
|
||||||
|
['searching.fields.stored_fields'],
|
||||||
|
['searching.fields.script_fields'],
|
||||||
|
['searching.fieldValueFactor']
|
||||||
|
)
|
||||||
->will($this->onConsecutiveCalls(
|
->will($this->onConsecutiveCalls(
|
||||||
|
$this->throwException(new InvalidArgumentException),
|
||||||
|
$this->throwException(new InvalidArgumentException),
|
||||||
$this->throwException(new InvalidArgumentException),
|
$this->throwException(new InvalidArgumentException),
|
||||||
$fieldConfig
|
$fieldConfig
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue