Dumplie\Customer\Tests\AbstractCustomerContext::createNewCartWithProducts PHP 메소드

createNewCartWithProducts() 공개 메소드

public createNewCartWithProducts ( string $currency = 'EUR', array $skuCodes = [] ) : CartId
$currency string
$skuCodes array
리턴 Dumplie\Customer\Domain\CartId
    public function createNewCartWithProducts(string $currency = 'EUR', array $skuCodes = []) : CartId
    {
        $cartId = CartId::generate();
        $command = new CreateCart((string) $cartId, $currency);
        $this->commandBus->handle($command);
        foreach ($skuCodes as $sku) {
            $addToCartCommand = new AddToCart($sku, 1, (string) $cartId);
            $this->commandBus->handle($addToCartCommand);
        }
        return $cartId;
    }