コード例 #1
0
 /**
  * @magentoDataFixture Magento/Catalog/_files/categories.php
  * @magentoAppIsolation enabled
  */
 public function testInitProduct()
 {
     \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Catalog\\Model\\Session')->setLastVisitedCategoryId(2);
     $this->_helper->initProduct(1, 'view');
     /** @var $objectManager \Magento\TestFramework\ObjectManager */
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $this->assertInstanceOf('Magento\\Catalog\\Model\\Product', $objectManager->get('Magento\\Framework\\Registry')->registry('current_product'));
     $this->assertInstanceOf('Magento\\Catalog\\Model\\Category', $objectManager->get('Magento\\Framework\\Registry')->registry('current_category'));
 }