/** * @covers \Magento\Catalog\Model\Product::getProductUrl * @covers \Magento\Catalog\Model\Product::getUrlInStore */ public function testGetProductUrl() { $this->assertStringEndsWith('catalog/product/view/', $this->_model->getProductUrl()); $this->assertStringEndsWith('catalog/product/view/', $this->_model->getUrlInStore()); $this->_model->setId(999); $url = $this->_model->getProductUrl(); $this->assertContains('catalog/product/view', $url); $this->assertContains('id/999', $url); $storeUrl = $this->_model->getUrlInStore(); $this->assertEquals($storeUrl, $url); }
/** * {@inheritdoc} */ public function getUrlInStore($params = array()) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getUrlInStore'); if (!$pluginInfo) { return parent::getUrlInStore($params); } else { return $this->___callPlugins('getUrlInStore', func_get_args(), $pluginInfo); } }
/** * @param Product $product * @param Store $store * @return string */ protected function buildUrl(Product $product, Store $store) { return $product->getUrlInStore(['_ignore_category' => true, '_nosid' => true, '_scope_to_url' => true, '_scope' => $store->getCode()]); }