Exemplo n.º 1
0
 protected function setUp()
 {
     parent::setUp();
     $this->_model = Bootstrap::getObjectManager()->create('Magento\\Checkout\\Model\\Type\\Onepage');
     /** @var \Magento\Quote\Model\Resource\Quote\Collection $quoteCollection */
     $quoteCollection = Bootstrap::getObjectManager()->create('Magento\\Quote\\Model\\Resource\\Quote\\Collection');
     /** @var \Magento\Quote\Model\Quote $quote */
     $this->_currentQuote = $quoteCollection->getLastItem();
     $this->_model->setQuote($this->_currentQuote);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function setQuote(\Magento\Quote\Model\Quote $quote)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'setQuote');
     if (!$pluginInfo) {
         return parent::setQuote($quote);
     } else {
         return $this->___callPlugins('setQuote', func_get_args(), $pluginInfo);
     }
 }
Exemplo n.º 3
0
 public function testSaveCheckoutMethod()
 {
     $this->assertEquals(['error' => -1, 'message' => 'Invalid data'], $this->onepage->saveCheckoutMethod(null));
     /** @var \Magento\Quote\Model\Quote|\PHPUnit_Framework_MockObject_MockObject $quoteMock */
     $quoteMock = $this->getMock('Magento\\Quote\\Model\\Quote', ['setCheckoutMethod', '__wakeup'], [], '', false);
     $quoteMock->expects($this->once())->method('setCheckoutMethod')->with('someMethod')->will($this->returnSelf());
     $this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock);
     $this->checkoutSessionMock->expects($this->once())->method('setStepData')->with('billing', 'allow', true);
     $this->onepage->setQuote($quoteMock);
     $this->assertEquals([], $this->onepage->saveCheckoutMethod('someMethod'));
 }