Beispiel #1
0
 /**
  * Cover currentUrlRewritesRegenerate().
  *
  * @cover \Magento\CatalogUrlRewrite\Model\Product\Plugin\Import::generateForCustom
  */
 public function testCurrentUrlRewritesRegenerateForCustomWithTargetPathGeneration()
 {
     $productId = 'entity id value';
     $storeId = 'store id value';
     $products = [$productId => [$storeId => 'value']];
     $this->setPropertyValue($this->import, 'products', $products);
     $requestPath = 'generate-for-custom-without-redirect-type.html';
     $targetPath = 'generated-target-path.html';
     $description = 'description';
     $this->urlFinder->expects($this->once())->method('findAllByData')->will($this->returnValue($this->currentUrlRewritesRegeneratorGetCurrentRewritesMocks([[UrlRewrite::REQUEST_PATH => $requestPath, UrlRewrite::TARGET_PATH => 'custom-target-path.html', UrlRewrite::REDIRECT_TYPE => 'code', UrlRewrite::IS_AUTOGENERATED => 0, UrlRewrite::DESCRIPTION => $description, UrlRewrite::METADATA => [], UrlRewrite::ENTITY_ID => $productId, UrlRewrite::STORE_ID => $storeId]])));
     $this->productUrlPathGenerator->expects($this->any())->method('getUrlPathWithSuffix')->will($this->returnValue($targetPath));
     $this->product->expects($this->any())->method('getId')->will($this->returnValue($productId));
     $this->currentUrlRewritesRegeneratorPrepareUrlRewriteMock($storeId, $productId, $requestPath, $targetPath, 'code', [], $description);
     $actualResult = $this->import->currentUrlRewritesRegenerate();
     $this->assertEquals([[$this->urlRewrite]], $actualResult);
 }
Beispiel #2
0
 /**
  * Test for clearProductUrls()
  */
 public function testClearProductUrls()
 {
     $this->import->clearProductUrls($this->observer);
 }