Dumplie\Customer\Tests\CustomerContext::createNewCartWithProducts PHP Method

createNewCartWithProducts() public method

public createNewCartWithProducts ( string $currency = 'EUR', array $skuCodes = [] ) : CartId
$currency string
$skuCodes array
return Dumplie\Customer\Domain\CartId
    public function createNewCartWithProducts(string $currency = 'EUR', array $skuCodes = []) : CartId;

Usage Example

Exemplo n.º 1
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);
 }