/** * @param bool $isMinQueryLength * @param string $expectedResult * @dataProvider getNoResultTextDataProvider */ public function testGetNoResultText($isMinQueryLength, $expectedResult) { $this->dataMock->expects($this->once())->method('isMinQueryLength')->will($this->returnValue($isMinQueryLength)); if ($isMinQueryLength) { $queryMock = $this->getMock('Magento\\Search\\Model\\Query', [], [], '', false); $queryMock->expects($this->once())->method('getMinQueryLength')->will($this->returnValue('5')); $this->queryFactoryMock->expects($this->once())->method('get')->will($this->returnValue($queryMock)); } $this->assertEquals($expectedResult, $this->model->getNoResultText()); }
/** * Retrieve search result count * * @return string */ public function getResultCount() { if ($this->fallback) { return parent::getResultCount(); } if (!$this->getData('result_count')) { $query = $this->_getQuery(); $size = $this->hasSubPhrases() ? $this->p13nHelper->getSubPhraseTotalHitCount($this->queries[\Boxalino\Intelligence\Block\Product\BxListProducts::$number]) : $this->p13nHelper->getTotalHitCount(); $this->setResultCount($size); $query->saveNumResults($size); } return $this->getData('result_count'); }
/** * Change default behavior of the search result block. * Order has to be set to ASC and not DESC. * * @param \Magento\CatalogSearch\Block\Result $resultBlock Result block. * @param \Closure $proceed Original method. * * @return \Magento\CatalogSearch\Block\Result */ public function aroundSetListOrders(Result $resultBlock, \Closure $proceed) { $proceed(); $resultBlock->getListBlock()->setDefaultDirection('asc'); return $resultBlock; }