示例#1
0
 public function testAroundDispatchHasSortDirection()
 {
     $this->toolbarModelMock->expects($this->exactly(1))->method('getDirection')->will($this->returnValue('asc'));
     $this->toolbarModelMock->expects($this->once())->method('getOrder')->will($this->returnValue('Name'));
     $this->toolbarModelMock->expects($this->once())->method('getMode')->will($this->returnValue('list'));
     $this->toolbarModelMock->expects($this->once())->method('getLimit')->will($this->returnValue(array(1 => 1, 2 => 2)));
     $this->productListHelperMock->expects($this->once())->method('getDefaultSortField')->will($this->returnValue('Field'));
     $this->productListHelperMock->expects($this->exactly(2))->method('getDefaultViewMode')->will($this->returnValue('grid'));
     $this->productListHelperMock->expects($this->once())->method('getDefaultLimitPerPageValue')->will($this->returnValue(array(10 => 10)));
     $this->httpContextMock->expects($this->exactly(4))->method('setValue')->will($this->returnValueMap(array(array(\Magento\Catalog\Helper\Data::CONTEXT_CATALOG_SORT_DIRECTION, 'asc', \Magento\Catalog\Helper\Product\ProductList::DEFAULT_SORT_DIRECTION, $this->httpContextMock), array(\Magento\Catalog\Helper\Data::CONTEXT_CATALOG_SORT_ORDER, 'Name', 'Field', $this->httpContextMock), array(\Magento\Catalog\Helper\Data::CONTEXT_CATALOG_DISPLAY_MODE, 'list', 'grid', $this->httpContextMock), array(\Magento\Catalog\Helper\Data::CONTEXT_CATALOG_LIMIT, array(1 => 1, 2 => 2), array(10 => 10)))));
     $this->assertEquals('ExpectedValue', $this->plugin->aroundDispatch($this->subjectMock, $this->closureMock, $this->requestMock));
 }
示例#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());
 }