/** * @magentoDataFixture Magento/Catalog/_files/categories.php */ public function testGetRemoveUrl() { /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); /** @var $request \Magento\TestFramework\Request */ $request = $objectManager->create('Magento\\Framework\\App\\RequestInterface'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\RequestInterface')->setRoutingInfo(array('requested_route' => 'x', 'requested_controller' => 'y', 'requested_action' => 'z')); $request->setParam('cat', 4); $this->_model->getFilter()->apply($request, \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\View\\LayoutInterface')->createBlock('Magento\\Framework\\View\\Element\\Text')); $this->assertStringEndsWith('/x/y/z/?cat=3', $this->_model->getRemoveUrl()); }
/** * @param FilterItem $subject * @param \Closure $proceed * @return string * @throws \Magento\Framework\Exception\LocalizedException * * @see \Magento\Catalog\Model\Layer\Filter\Item::getUrl() */ public function aroundGetUrl(FilterItem $subject, \Closure $proceed) { $this->filter = $subject->getFilter(); $this->eavAttribute = $this->filter->getAttributeModel(); if ($this->canBeSubstituted()) { $result = $this->urlHelper->getOptionUrl($this->eavAttribute, $subject->getValue()); } else { $result = $proceed(); } return $result; }