/** * @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_simple.php * @magentoAppIsolation enabled */ public function testGetProductUrl() { $expectedUrl = 'http://localhost/index.php/simple-product.html'; $product = $this->productRepository->get('simple'); $this->assertEquals($expectedUrl, $this->helper->getProductUrl($product)); // product as ID $this->assertEquals($expectedUrl, $this->helper->getProductUrl($product->getId())); }
/** * @magentoDataFixture Magento/CatalogUrlRewrite/_files/product_simple.php * @magentoAppIsolation enabled */ public function testGetProductUrl() { $expectedUrl = 'http://localhost/index.php/simple-product.html'; // product as object $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Catalog\\Model\\Product'); $product->load(1); $this->assertEquals($expectedUrl, $this->_helper->getProductUrl($product)); // product as ID $this->assertEquals($expectedUrl, $this->_helper->getProductUrl(1)); }