Example #1
0
 /**
  * @covers \Magento\Catalog\Model\Layer\Search\CollectionFilter::filter
  * @covers \Magento\Catalog\Model\Layer\Search\CollectionFilter::__construct
  */
 public function testFilter()
 {
     $collectionMock = $this->getMock('\\Magento\\Catalog\\Model\\Resource\\Product\\Collection', ['addAttributeToSelect', 'setStore', 'addMinimalPrice', 'addFinalPrice', 'addTaxPercents', 'addStoreFilter', 'addUrlRewrite', 'setVisibility'], [], '', false);
     $categoryMock = $this->getMock('\\Magento\\Catalog\\Model\\Category', [], [], '', false);
     $this->catalogConfigMock->expects($this->once())->method('getProductAttributes');
     $this->visibilityMock->expects($this->once())->method('getVisibleInSearchIds');
     $this->storeManagerMock->expects($this->once())->method('getStore');
     $collectionMock->expects($this->once())->method('addAttributeToSelect')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('setStore')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('addMinimalPrice')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('addFinalPrice')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('addTaxPercents')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('addStoreFilter')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('addUrlRewrite')->will($this->returnValue($collectionMock));
     $collectionMock->expects($this->once())->method('setVisibility')->will($this->returnValue($collectionMock));
     $this->model->filter($collectionMock, $categoryMock);
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function filter($collection, \Magento\Catalog\Model\Category $category)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'filter');
     if (!$pluginInfo) {
         return parent::filter($collection, $category);
     } else {
         return $this->___callPlugins('filter', func_get_args(), $pluginInfo);
     }
 }