/**
  * Test method
  */
 public function testGenerationForSpecificStore()
 {
     $this->category->expects($this->any())->method('getStoreId')->will($this->returnValue(1));
     $this->category->expects($this->never())->method('getStoreIds');
     $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite();
     $canonical->setTargetPath('category-1')->setStoreId(1);
     $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate')->will($this->returnValue([$canonical]));
     $this->childrenUrlRewriteGenerator->expects($this->any())->method('generate')->will($this->returnValue([]));
     $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')->will($this->returnValue([]));
     $this->assertEquals([$canonical], $this->categoryUrlRewriteGenerator->generate($this->category));
 }
 /**
  * Test method
  */
 public function testSkipGenerationForNotStoreRootCategory()
 {
     $this->product->expects($this->any())->method('getStoreId')->will($this->returnValue(1));
     $this->product->expects($this->never())->method('getStoreIds');
     $category = $this->getMock('Magento\\Catalog\\Model\\Category', [], [], '', false);
     $category->expects($this->any())->method('getParentIds')->will($this->returnValue(['root-id', 'root-for-store-id']));
     $store = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
     $store->expects($this->any())->method('getRootCategoryId')->will($this->returnValue('not-root-id'));
     $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($store));
     $this->categoriesCollection->expects($this->any())->method('getIterator')->willReturn(new \ArrayIterator([$category]));
     $this->initObjectRegistryFactory([]);
     $canonical = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite();
     $canonical->setTargetPath('category-1')->setStoreId(1);
     $this->canonicalUrlRewriteGenerator->expects($this->any())->method('generate')->will($this->returnValue([$canonical]));
     $this->categoriesUrlRewriteGenerator->expects($this->any())->method('generate')->will($this->returnValue([]));
     $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate')->will($this->returnValue([]));
     $this->anchorUrlRewriteGenerator->expects($this->any())->method('generate')->will($this->returnValue([]));
     $this->assertEquals(['category-1-1' => $canonical], $this->productUrlRewriteGenerator->generate($this->product));
 }