File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 9
9
*/
10
10
use IntegerNet \Solr \Query \Params \FilterQueryBuilder ;
11
11
use IntegerNet \Solr \Request \HasFilter ;
12
- use IntegerNet \Solr \Request \Request ;
13
12
14
13
class IntegerNet_Solr_Model_Result
15
14
{
@@ -24,11 +23,11 @@ class IntegerNet_Solr_Model_Result
24
23
/**
25
24
* @var $_solrResult null|\IntegerNet\Solr\Resource\SolrResponse
26
25
*/
27
- protected $ _solrResult = null ;
26
+ protected $ _solrResult ;
28
27
29
28
protected $ activeFilterAttributeCodes = array ();
30
29
31
- function __construct ()
30
+ public function __construct ()
32
31
{
33
32
$ this ->_solrRequest = Mage::helper ('integernet_solr ' )->factory ()->getSolrRequest ();
34
33
if ($ this ->_solrRequest instanceof HasFilter) {
@@ -46,7 +45,7 @@ function __construct()
46
45
*/
47
46
public function getSolrResult ()
48
47
{
49
- if (is_null ( $ this ->_solrResult ) ) {
48
+ if (null === $ this ->_solrResult ) {
50
49
$ this ->_solrResult = $ this ->_solrRequest ->doRequest ($ this ->activeFilterAttributeCodes );
51
50
}
52
51
Original file line number Diff line number Diff line change @@ -161,6 +161,39 @@ public function shouldUseDefaultParametersWithoutToolbar()
161
161
$ this ->setCurrentStore ($ storeId );
162
162
$ result ->getSolrResult ();
163
163
}
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
+ }
164
197
165
198
/**
166
199
* @test
You can’t perform that action at this time.
0 commit comments