Skip to content

Commit 49a4599

Browse files
committed
Adjust integration test after change in base module
Refactoring to be considered
1 parent 72f62d3 commit 49a4599

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed

src/app/code/community/IntegerNet/Solr/Model/Result.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010
use IntegerNet\Solr\Query\Params\FilterQueryBuilder;
1111
use IntegerNet\Solr\Request\HasFilter;
12-
use IntegerNet\Solr\Request\Request;
1312

1413
class IntegerNet_Solr_Model_Result
1514
{
@@ -24,11 +23,11 @@ class IntegerNet_Solr_Model_Result
2423
/**
2524
* @var $_solrResult null|\IntegerNet\Solr\Resource\SolrResponse
2625
*/
27-
protected $_solrResult = null;
26+
protected $_solrResult;
2827

2928
protected $activeFilterAttributeCodes = array();
3029

31-
function __construct()
30+
public function __construct()
3231
{
3332
$this->_solrRequest = Mage::helper('integernet_solr')->factory()->getSolrRequest();
3433
if ($this->_solrRequest instanceof HasFilter) {
@@ -46,7 +45,7 @@ function __construct()
4645
*/
4746
public function getSolrResult()
4847
{
49-
if (is_null($this->_solrResult)) {
48+
if (null === $this->_solrResult) {
5049
$this->_solrResult = $this->_solrRequest->doRequest($this->activeFilterAttributeCodes);
5150
}
5251

src/app/code/community/IntegerNet/Solr/Test/Model/Result.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,39 @@ public function shouldUseDefaultParametersWithoutToolbar()
161161
$this->setCurrentStore($storeId);
162162
$result->getSolrResult();
163163
}
164+
/**
165+
* @test
166+
*/
167+
public function shouldExpandPageSizeIfFuzzyIsActive()
168+
{
169+
$storeId = 1;
170+
$query = 'tshirt';
171+
172+
$this->app()->getStore($storeId)->setConfig('integernet_solr/fuzzy/is_active', 1);
173+
$this->app()->getLayout()->unsetBlock('product_list_toolbar');
174+
$searchHelperStub = $this->mockHelper('catalogsearch', ['getQueryText']);
175+
$searchHelperStub->expects($this->any())
176+
->method('getQueryText')
177+
->willReturn($query);
178+
$this->replaceByMock('helper', 'catalogsearch', $searchHelperStub);
179+
180+
$this->_resourceMock->expects($this->exactly(2))
181+
->method('search')
182+
->with(
183+
$storeId,
184+
$this->stringContains($query),
185+
0,
186+
99999,
187+
$this->logicalAnd(
188+
$this->isType('array'),
189+
$this->contains('score desc', true, true),
190+
$this->logicalNot($this->arrayHasKey('rows'))
191+
))
192+
->willReturn($this->_getDummyResponse());
193+
$result = Mage::getModel('integernet_solr/result');
194+
$this->setCurrentStore($storeId);
195+
$result->getSolrResult();
196+
}
164197

165198
/**
166199
* @test

0 commit comments

Comments
 (0)