コード例 #1
0
 /**
  * @magentoDataFixture Magento/Sales/_files/quote.php
  */
 protected function setUp()
 {
     $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $quote = $this->_objectManager->create('Magento\\Quote\\Model\\Quote')->load(1);
     $sessionQuoteMock = $this->getMockBuilder('Magento\\Backend\\Model\\Session\\Quote')->disableOriginalConstructor()->setMethods(['getCustomerId', 'getStore', 'getStoreId', 'getQuote'])->getMock();
     $sessionQuoteMock->expects($this->any())->method('getCustomerId')->will($this->returnValue(1));
     $sessionQuoteMock->expects($this->any())->method('getQuote')->will($this->returnValue($quote));
     /** @var \Magento\Framework\View\LayoutInterface $layout */
     $layout = $this->_objectManager->get('Magento\\Framework\\View\\LayoutInterface');
     $this->_accountBlock = $layout->createBlock('Magento\\Sales\\Block\\Adminhtml\\Order\\Create\\Form\\Account', 'address_block' . rand(), ['sessionQuote' => $sessionQuoteMock]);
     parent::setUp();
 }
コード例 #2
0
ファイル: ViewTest.php プロジェクト: aiesh/magento2
 /**
  * @magentoDataFixture Magento/Catalog/_files/multiple_products.php
  * @magentoAppIsolation enabled
  * @magentoAppArea frontend
  */
 public function testPrepareAndRender()
 {
     $this->_helper->prepareAndRender(10, $this->_controller);
     $this->assertNotEmpty($this->_controller->getResponse()->getBody());
     $this->assertEquals(10, $this->objectManager->get('Magento\\Catalog\\Model\\Session')->getLastViewedProductId());
 }