Наследование: extends Dumplie\SharedKernel\Tests\Context\Context
Пример #1
0
 function test_change_billing_address()
 {
     $cartId = $this->customerContext->createEmptyCart();
     $command = new NewCheckout((string) $cartId, "Norbert Orzechowicz", "ul. FLorianska 1", "30-300", "Kraków", "PL");
     $this->customerContext->commandBus()->handle($command);
     $changeBillingAddress = new ChangeBillingAddress((string) $cartId, "Lesze Prabucki", "ul. Rynek 2", "40-400", "Gdańsk", "PL");
     $this->customerContext->commandBus()->handle($changeBillingAddress);
     $this->clear();
     $this->assertEquals("Lesze Prabucki, 40-400 Gdańsk, ul. Rynek 2, PL", (string) $this->customerContext->checkouts()->getForCart($cartId)->billingAddress());
 }
Пример #2
0
 function test_placing_order_with_the_same_id_twice()
 {
     $this->expectException(OrderAlreadyExistsException::class);
     $cartId = $this->customerContext->createNewCartWithProducts('EUR', ['SKU_1', 'SKU_2']);
     $this->customerContext->checkout($cartId);
     $orderId = OrderId::generate();
     $placeOrderCommand = new PlaceOrder((string) $cartId, (string) $orderId);
     $this->customerContext->commandBus()->handle($placeOrderCommand);
     $this->customerContext->commandBus()->handle($placeOrderCommand);
 }
Пример #3
0
 function test_removing_products_from_cart()
 {
     $cartId = $this->customerContext->createEmptyCart('EUR');
     $addCommand = new AddToCart('SKU_1', 2, (string) $cartId);
     $this->customerContext->commandBus()->handle($addCommand);
     $removeCommand = new RemoveFromCart((string) $cartId, 'SKU_1');
     $this->customerContext->commandBus()->handle($removeCommand);
     $this->clear();
     $cart = $this->customerContext->carts()->getById($cartId);
     $this->assertTrue($cart->isEmpty());
 }