Exemplo n.º 1
0
 public function testGenerationForCustomWithTargetPathGeneration()
 {
     $storeId = 12;
     $categoryId = 123;
     $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->getCurrentRewritesMocks([[UrlRewrite::REQUEST_PATH => $requestPath, UrlRewrite::TARGET_PATH => 'custom-target-path.html', UrlRewrite::REDIRECT_TYPE => 'code', UrlRewrite::IS_AUTOGENERATED => 0, UrlRewrite::DESCRIPTION => $description, UrlRewrite::METADATA => []]])));
     $this->categoryUrlPathGenerator->expects($this->any())->method('getUrlPathWithSuffix')->will($this->returnValue($targetPath));
     $this->category->expects($this->any())->method('getId')->will($this->returnValue($categoryId));
     $this->urlRewriteBuilder->expects($this->once())->method('setDescription')->with($description)->will($this->returnSelf());
     $this->prepareUrlRewriteMock($storeId, $categoryId, $requestPath, $targetPath, 'code');
     $this->assertEquals([$this->urlRewrite], $this->currentUrlRewritesRegenerator->generate($storeId, $this->category));
 }
 /**
  * Generate list of urls per store
  *
  * @param string $storeId
  * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
  */
 protected function generateForSpecificStoreView($storeId)
 {
     $urls = array_merge($this->canonicalUrlRewriteGenerator->generate($storeId, $this->category), $this->childrenUrlRewriteGenerator->generate($storeId, $this->category), $this->currentUrlRewritesRegenerator->generate($storeId, $this->category));
     return $urls;
 }