function it_tries_to_pay_again(SharedStorageInterface $sharedStorage, OrderRepositoryInterface $orderRepository, PaypalApiMocker $paypalApiMocker, OrderPaymentsPageInterface $orderPaymentsPage, OrderInterface $order, CustomerInterface $customer, UserInterface $user, PaymentInterface $payment) { $sharedStorage->get('user')->willReturn($user); $user->getCustomer()->willReturn($customer); $orderRepository->findByCustomer($customer)->willReturn([$order]); $order->getLastPayment()->willReturn($payment); $paypalApiMocker->mockApiPaymentInitializeResponse()->shouldBeCalled(); $orderPaymentsPage->clickPayButtonForGivenPayment($payment)->shouldBeCalled(); $this->iTryToPayAgain(); }
/** * @When I try to pay again */ public function iTryToPayAgain() { $order = $this->getLastOrder(); $payment = $order->getLastPayment(); $this->paypalApiMocker->mockApiPaymentInitializeResponse(); $this->orderPaymentsPage->clickPayButtonForGivenPayment($payment); }
/** * @Then I should see two cancelled payments and new one ready to be paid */ public function iShouldSeeTwoCancelledPaymentsAndNewOneReadyToBePaid() { expect($this->orderPaymentsPage->countPaymentWithSpecificState(PaymentInterface::STATE_CANCELLED))->toBe(2); expect($this->orderPaymentsPage->countPaymentWithSpecificState(PaymentInterface::STATE_NEW))->toBe(1); }