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()); }
function test_placing_new_order() { $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->clear(); $this->assertFalse($this->customerContext->carts()->exists($cartId)); $this->assertFalse($this->customerContext->checkouts()->existsForCart($cartId)); $this->assertTrue($this->customerContext->orders()->exists($orderId)); }