コード例 #1
0
 /**
  * @magentoDbIsolation enabled
  * @throws \Exception
  */
 public function testLoadByIdPath()
 {
     $this->model->setStoreId($this->objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->getDefaultStoreView()->getId())->setRequestPath('product1.html')->setTargetPath('catalog/product/view/id/1')->setIdPath('product/1')->setIsSystem(1)->setOptions('RP')->save();
     try {
         $read = $this->objectManager->create('Magento\\UrlRewrite\\Model\\UrlRewrite');
         $read->setStoreId($this->objectManager->get('Magento\\Store\\Model\\StoreManagerInterface')->getDefaultStoreView()->getId())->loadByIdPath('product/1');
         $this->assertEquals($this->model->getStoreId(), $read->getStoreId());
         $this->assertEquals($this->model->getRequestPath(), $read->getRequestPath());
         $this->assertEquals($this->model->getTargetPath(), $read->getTargetPath());
         $this->assertEquals($this->model->getIdPath(), $read->getIdPath());
         $this->assertEquals($this->model->getIsSystem(), $read->getIsSystem());
         $this->assertEquals($this->model->getOptions(), $read->getOptions());
         $this->model->delete();
     } catch (\Exception $e) {
         $this->model->delete();
         throw $e;
     }
 }