예제 #1
0
 public function testRemoveOrderFromAvailableOrders()
 {
     $data = ['name' => [], 'price' => []];
     $this->catalogConfig->expects($this->once())->method('getAttributeUsedForSortByArray')->will($this->returnValue($data));
     $toolbar = $this->block->removeOrderFromAvailableOrders('order', 'value');
     $this->assertEquals($data, $toolbar->getAvailableOrders());
     $toolbar2 = $this->block->removeOrderFromAvailableOrders('name');
     $this->assertEquals(['price' => []], $toolbar2->getAvailableOrders());
 }
예제 #2
0
 public function testGetPagerHtml()
 {
     $limit = 10;
     $this->layout->expects($this->once())->method('getChildName')->will($this->returnValue('product_list_toolbar_pager'));
     $this->layout->expects($this->once())->method('getBlock')->will($this->returnValue($this->pagerBlock));
     $this->productListHelper->expects($this->exactly(2))->method('getAvailableLimit')->will($this->returnValue([10 => 10, 20 => 20]));
     $this->model->expects($this->once())->method('getLimit')->will($this->returnValue($limit));
     $this->pagerBlock->expects($this->once())->method('setUseContainer')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setShowPerPage')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setShowAmounts')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setFrameLength')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setJump')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setLimit')->with($limit)->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('setCollection')->will($this->returnValue($this->pagerBlock));
     $this->pagerBlock->expects($this->once())->method('toHtml')->will($this->returnValue(true));
     $this->assertTrue($this->block->getPagerHtml());
 }
예제 #3
0
 /**
  * BxToolbar constructor.
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Model\Session $catalogSession
  * @param \Magento\Catalog\Model\Config $catalogConfig
  * @param ToolbarModel $toolbarModel
  * @param \Magento\Framework\Url\EncoderInterface $urlEncoder
  * @param ProductList $productListHelper
  * @param \Magento\Framework\Data\Helper\PostHelper $postDataHelper
  * @param \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper
  * @param \Boxalino\Intelligence\Helper\Data $bxHelperData
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\Session $catalogSession, \Magento\Catalog\Model\Config $catalogConfig, ToolbarModel $toolbarModel, \Magento\Framework\Url\EncoderInterface $urlEncoder, ProductList $productListHelper, \Magento\Framework\Data\Helper\PostHelper $postDataHelper, \Boxalino\Intelligence\Helper\P13n\Adapter $p13nHelper, \Boxalino\Intelligence\Helper\Data $bxHelperData, array $data = [])
 {
     $this->p13Helper = $p13nHelper;
     $this->bxHelperData = $bxHelperData;
     parent::__construct($context, $catalogSession, $catalogConfig, $toolbarModel, $urlEncoder, $productListHelper, $postDataHelper, $data);
 }
 public function getLastPageNum()
 {
     if ($this->helper->isActiveEngine() && $this->helper->isPermittedHandle()) {
         return (int) $this->getData('last_page_num');
     } else {
         return parent::getLastPageNum();
     }
 }