function test_create_payment() { $orderId = OrderId::generate(); $paymentId = PaymentId::generate(); $this->customerServiceContext->customerPlacedOrder((string) $orderId); $command = new CreatePayment((string) $orderId, (string) $paymentId); $this->customerServiceContext->commandBus()->handle($command); $this->clear(); $payment = $this->customerServiceContext->payments()->getById($paymentId); $this->assertFalse($payment->isPaid()); $this->assertFalse($payment->isRejected()); }
/** * @param OrderId $orderId * @return PaymentId */ public function createPaymentFor(OrderId $orderId) : PaymentId { $paymentId = PaymentId::generate(); $command = new CreatePayment((string) $orderId, (string) $paymentId); $this->commandBus->handle($command); return $paymentId; }
function let() { $this->beConstructedWith(PaymentId::generate(), new Order(OrderId::generate(), new \DateTimeImmutable())); }