public function testExecuteGuest() { $agreement = ['test', 'test']; $quoteMock = $this->getQuoteMock(); $this->agreementsValidatorMock->expects(self::once())->method('isValid')->willReturn(true); $this->getCheckoutMethodStep($quoteMock); $this->prepareGuestQuoteStep($quoteMock); $this->disabledQuoteAddressValidationStep($quoteMock); $quoteMock->expects(self::once())->method('collectTotals'); $quoteMock->expects(self::once())->method('getId')->willReturn(10); $this->cartManagementMock->expects(self::once())->method('placeOrder')->with(10); $this->orderPlace->execute($quoteMock, $agreement); }
/** * @param $paymentMethod * @param $controller * @param $quoteId * @param $result * @dataProvider textExecuteFailedPlaceOrderDataProvider */ public function testExecuteFailedPlaceOrder($paymentMethod, $controller, $quoteId, $result) { $this->requestMock->expects($this->at(0))->method('getParam')->with('payment')->will($this->returnValue($paymentMethod)); $this->requestMock->expects($this->at(1))->method('getParam')->with('controller')->will($this->returnValue($controller)); $this->quoteMock->expects($this->any())->method('getId')->will($this->returnValue($quoteId)); $this->cartManagementMock->expects($this->once())->method('placeOrder')->willThrowException(new \Exception()); $this->jsonHelperMock->expects($this->any())->method('jsonEncode')->with($result); $this->placeOrderController->execute(); }