public function testPersistNewPayment() { $fee = new EntranceFee(); $fee->setDurationValue(12); $ticket = new Ticket($fee); $this->repository->expects($this->once())->method('persist'); $this->user->expects($this->once())->method('addTicket'); $this->sut->persistNewPayment($ticket); }
/** * Persists the new ticket * * @param string $transactionId * @param string $payerId * @param string $payerEmail */ protected function persistance($transactionId, $payerId, $payerEmail) { $this->session->remove(self::PAYPAL_TOKEN); $ticket = $this->repository->createTicketFromPayment(); $ticket->setTransactionInfo(['transactionId' => $transactionId, 'payerId' => $payerId, 'payerEmail' => $payerEmail]); // save payment try { $this->repository->persistNewPayment($ticket); } catch (\Exception $e) { $this->logger->error(sprintf('Payment was not saved for user %s transaction %s (reason: %s)'), $this->getUser()->getUsername(), $transactionId, $e->getMessage()); } }