コード例 #1
0
ファイル: CartSpec.php プロジェクト: dumplie/dumplie
 function it_allows_to_remove_items()
 {
     $sku = new SKU("DUMPLIE_SKU_1");
     $this->add(new Product($sku, Price::EUR(100), true), 1);
     $this->remove($sku);
     $this->isEmpty()->shouldReturn(true);
 }
コード例 #2
0
ファイル: CheckoutSpec.php プロジェクト: dumplie/dumplie
 function it_can_be_used_to_place_order(Products $products, Carts $carts)
 {
     $product = new Product(new SKU("SKU"), Price::EUR(1000), true);
     $cart = new Cart(CartId::generate(), 'EUR');
     $cart->add($product, 1);
     $carts->getById(Argument::type(CartId::class))->willReturn($cart);
     $products->getBySku(Argument::type(SKU::class))->willReturn($product);
     $order = $this->placeOrder(OrderId::generate(), $products, $carts);
     $order->shouldBeAnInstanceOf(Order::class);
 }
コード例 #3
0
ファイル: OrderTest.php プロジェクト: dumplie/dumplie
 function setUp()
 {
     $this->eventLog = new InMemoryEventLog();
     $this->transactionFactory = new Factory();
     $this->customerContext = new InMemoryCustomerContext($this->eventLog, new TacticianFactory(), [new Product(new SKU('SKU_1'), Price::EUR(2500), true), new Product(new SKU('SKU_2'), Price::EUR(2500), true)]);
 }
コード例 #4
0
ファイル: PriceTest.php プロジェクト: dumplie/dumplie
 function test_if_can_be_created_through_static_constructor()
 {
     $price = Price::EUR(10000);
     $this->assertEquals(100.0, $price->floatValue());
     $this->assertEquals('EUR', $price->currency());
 }
コード例 #5
0
ファイル: PriceSpec.php プロジェクト: dumplie/dumplie
 function it_throws_exception_when_adding_to_price_with_a_different_precisions()
 {
     $this->beConstructedWith(10000, 'EUR', 100);
     $this->shouldThrow(DifferentPricePrecisionException::class)->during('add', [Price::EUR(100, 10)]);
 }