Exemplo n.º 1
0
 public function it_checkouts_a_payment(Factory\Payment $paymentFactory, Item $item1, Item $item2, PaymentInterface $paymentInterface, Processor $processor)
 {
     $this->beConstructedWith($paymentFactory, [$item1, $item2], $paymentInterface);
     $item1->getPrice()->willReturn(100);
     $item2->getPrice()->willReturn(200);
     $processor->add(100)->shouldBeCalled();
     $processor->add(200)->shouldBeCalled();
     $processor->pay($paymentInterface)->shouldBeCalled();
     $this->checkout($processor);
 }
Exemplo n.º 2
0
 public function it_checkouts_a_credit_order(Payment $payment, Processor $processor, Item $item1, Item $item2, Credit $credit)
 {
     $this->beConstructedWith($payment, [$item1, $item2], true);
     $item1->getPrice()->willReturn(100);
     $item2->getPrice()->willReturn(200);
     $processor->add(100)->shouldBeCalled();
     $processor->add(200)->shouldBeCalled();
     $payment->getCredit()->willReturn($credit);
     $processor->pay($credit)->shouldBeCalled();
     $this->checkout($processor);
 }