Пример #1
0
 /**
  * @param \Magento\Framework\App\Action\Action $subject
  * @param callable $proceed
  * @param \Magento\Framework\App\RequestInterface $request
  * @return mixed
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function aroundDispatch(\Magento\Framework\App\Action\Action $subject, \Closure $proceed, \Magento\Framework\App\RequestInterface $request)
 {
     $this->httpContext->setValue(Data::CONTEXT_CATALOG_SORT_DIRECTION, $this->toolbarModel->getDirection(), \Magento\Catalog\Helper\Product\ProductList::DEFAULT_SORT_DIRECTION);
     $this->httpContext->setValue(Data::CONTEXT_CATALOG_SORT_ORDER, $this->toolbarModel->getOrder(), $this->productListHelper->getDefaultSortField());
     $this->httpContext->setValue(Data::CONTEXT_CATALOG_DISPLAY_MODE, $this->toolbarModel->getMode(), $this->productListHelper->getDefaultViewMode());
     $this->httpContext->setValue(Data::CONTEXT_CATALOG_LIMIT, $this->toolbarModel->getLimit(), $this->productListHelper->getDefaultLimitPerPageValue($this->productListHelper->getDefaultViewMode()));
     return $proceed($request);
 }
Пример #2
0
 public function testGetMode()
 {
     $this->assertNull($this->toolbar->getMode());
     $_COOKIE[Toolbar::MODE_COOKIE_NAME] = 'modeCookie';
     $this->assertEquals('modeCookie', $this->toolbar->getMode());
 }
Пример #3
0
 /**
  * @dataProvider stringParamProvider
  * @param $param
  */
 public function testGetMode($param)
 {
     $this->requestMock->expects($this->once())->method('getParam')->with(Toolbar::MODE_PARAM_NAME)->will($this->returnValue($param));
     $this->assertEquals($param, $this->toolbarModel->getMode());
 }
Пример #4
0
 /**
  * Retrieve current View mode
  *
  * @return string
  */
 public function getCurrentMode()
 {
     $mode = $this->_getData('_current_grid_mode');
     if ($mode) {
         return $mode;
     }
     $defaultMode = $this->_productListHelper->getDefaultViewMode($this->getModes());
     $mode = $this->_toolbarModel->getMode();
     if (!$mode || !isset($this->_availableMode[$mode])) {
         $mode = $defaultMode;
     }
     $this->setData('_current_grid_mode', $mode);
     return $mode;
 }
Пример #5
0
 /**
  * @dataProvider stringParamProvider
  * @param $param
  */
 public function testGetMode($param)
 {
     $this->cookieManagerMock->expects($this->once())->method('getCookie')->with(Toolbar::MODE_COOKIE_NAME)->will($this->returnValue($param));
     $this->assertEquals($param, $this->toolbarModel->getMode());
 }