/**
  * Generate list of urls for specific store view
  *
  * @param int $storeId
  * @param \Magento\Framework\Data\Collection $productCategories
  * @return \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
  */
 protected function generateForSpecificStoreView($storeId, $productCategories)
 {
     $categories = [];
     foreach ($productCategories as $category) {
         if ($this->isCategoryProperForGenerating($category, $storeId)) {
             $categories[] = $category;
         }
     }
     $this->productCategories = $this->objectRegistryFactory->create(['entities' => $categories]);
     /**
      * @var $urls \Magento\UrlRewrite\Service\V1\Data\UrlRewrite[]
      */
     $urls = array_merge($this->canonicalUrlRewriteGenerator->generate($storeId, $this->product), $this->categoriesUrlRewriteGenerator->generate($storeId, $this->product, $this->productCategories), $this->currentUrlRewritesRegenerator->generate($storeId, $this->product, $this->productCategories));
     /* Reduce duplicates. Last wins */
     $result = [];
     foreach ($urls as $url) {
         $result[$url->getTargetPath() . '-' . $url->getStoreId()] = $url;
     }
     $this->productCategories = null;
     return $result;
 }
 /**
  * @param array $entities
  */
 protected function initObjectRegistryFactory($entities)
 {
     $objectRegistry = $this->getMockBuilder('Magento\\CatalogUrlRewrite\\Model\\ObjectRegistry')->disableOriginalConstructor()->getMock();
     $this->objectRegistryFactory->expects($this->any())->method('create')->with(['entities' => $entities])->will($this->returnValue($objectRegistry));
 }