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); }
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); }
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)]); }
function test_if_can_be_created_through_static_constructor() { $price = Price::EUR(10000); $this->assertEquals(100.0, $price->floatValue()); $this->assertEquals('EUR', $price->currency()); }
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)]); }