protected function setupCart()
 {
     $quoteMock = $this->getMockBuilder('\\Magento\\Quote\\Model\\Quote')->disableOriginalConstructor()->setMethods(['hasItems', 'getHasError', 'getPayment'])->getMock();
     $quoteMock->expects($this->any())->method('hasItems')->willReturn(true);
     $quoteMock->expects($this->any())->method('getHasError')->willReturn(false);
     $this->checkoutSessionMock->expects($this->any())->method('getQuote')->willReturn($quoteMock);
     $this->checkoutFactoryMock->expects($this->any())->method('create')->willReturn($this->checkoutMock);
     return $quoteMock;
 }
Пример #2
0
 /**
  * @return \Magento\Braintree\Model\Checkout
  */
 protected function getCheckout()
 {
     if (!$this->checkout) {
         $this->checkout = $this->checkoutFactory->create(['params' => ['quote' => $this->checkoutSession->getQuote(), 'config' => $this->paypalConfig]]);
     }
     return $this->checkout;
 }