name = 'Gamme Vider Panier ' . uniqid(); $range->status = true; $range->order = 1; $range->picture_alt = 'alt'; $range->picture_title = 'title'; $range->saveOrFail(); $product = new Product([ 'range_id' => $range->id, 'name' => 'Produit À Vider ' . uniqid(), 'brand' => ProductBrand::loue, 'invoicing_unit' => InvoicingUnit::PCE, 'sell_unit' => SellUnit::PCE, 'order_unit' => OrderUnit::PCE, 'tax_rate' => TaxRate::TVA_5_5, 'description' => 'Desc', 'status' => true, ]); $product->price = Money::EUR(900); $product->short_description = 'Court'; $product->picture_alt = 'alt'; $product->picture_title = 'title'; $product->picture_large_alt = 'alt large'; $product->picture_large_title = 'title large'; $product->saveOrFail(); $inco = new ProductInco(); $inco->product_id = $product->id; $inco->no_art = random_int(10000, 99999); $inco->saveOrFail(); /** @var \Illuminate\Contracts\Session\Session $session */ $session = Session::driver(); $builderManager = new SessionOrderBuilderManager($session, 'order_tunnel_builder_session'); $dispatcher = new LaravelDomainEventDispatcher(); $basketSvc = new BasketService( new SessionBasketRepository($session, 'basket_', new BasketSerializer()), new EloquentProductRepository(), new AppSessionService('domain_session_uuid'), $dispatcher, ); $basketSvc->add($product->getId(), 2); $builderManager->save(OrderBuilder::fromBasket( new Basket(new BasketId(UuidHelper::v7()), []), new ShopperId(UuidHelper::v7()), )); $executor = new ActionExecutorService( new LaravelCacheLock(new Repository(new ArrayStore())), new NullLogger(), $dispatcher, ); // WHEN $executor->execute(new EmptyBasket($basketSvc), ActionInputEmpty::create()); // THEN expect($basketSvc->hasItems())->toBeFalse() ->and($basketSvc->getBasket()->items())->toBeEmpty() ->and($builderManager->get())->toBeNull(); }); });