public function testFormatUrlKey() { $strIn = 'Some string'; $resultString = 'some'; $this->filterManager->expects($this->once())->method('translitUrl')->with($strIn)->will($this->returnValue($resultString)); $this->assertEquals($resultString, $this->category->formatUrlKey($strIn)); }
/** * Generate category url key * * @param \Magento\Catalog\Model\Category $category * @return string */ public function generateUrlKey($category) { $urlKey = $category->getUrlKey(); return $category->formatUrlKey($urlKey === '' || $urlKey === null ? $category->getName() : $urlKey); }
/** * Generate category url key path * * @param \Magento\Catalog\Model\Category $category * @return string */ public function generateCategoryUrlKeyPath($category) { $parentPath = $this->categoryHelper->getCategoryUrlPath('', true, $category->getStoreId()); $urlKey = $category->getUrlKey() == '' ? $category->formatUrlKey($category->getName()) : $category->formatUrlKey($category->getUrlKey()); return $parentPath . $urlKey; }
public function testFormatUrlKey() { $this->assertEquals('test', $this->_model->formatUrlKey('test')); $this->assertEquals('test-some-chars-5', $this->_model->formatUrlKey('test-some#-chars^5')); $this->assertEquals('test', $this->_model->formatUrlKey('test-????????')); }
/** * {@inheritdoc} */ public function formatUrlKey($str) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'formatUrlKey'); if (!$pluginInfo) { return parent::formatUrlKey($str); } else { return $this->___callPlugins('formatUrlKey', func_get_args(), $pluginInfo); } }