/** * Refresh product rewrites * * @param \Magento\Framework\Object $object * @return $this */ public function afterSave($object) { if ($object->dataHasChangedFor($this->getAttribute()->getName())) { $this->_catalogUrl->refreshProductRewrites(null, $object, true); } return $this; }
/** * @magentoDataFixture Magento/Catalog/_files/url_rewrites_invalid.php */ public function testRefreshProductRewrites() { $this->assertNotEmpty($this->_loadRewrite('product/1/4')->getId()); $this->_model->refreshProductRewrites(1); $this->markTestIncomplete('Rewrite was not removed after refresh, method responsibility is not clear.'); $this->assertEmpty($this->_loadRewrite('product/1/4')->getId()); }