TASK: Fix broken tests for query factory

This commit is contained in:
Daniel Siepmann 2017-10-29 13:03:58 +01:00
parent 7a5bea687e
commit 85bfb86f5f
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -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
)); ));