name = 'Boutique Retrait'; $shop->address = '10 rue Principale'; $shop->postcode = '75001'; $shop->city = 'Paris'; $shop->default = true; $shop->save(); $reference = new OrderReference(UuidHelper::v7()); $order = new Order(); $order->reference = $reference; $order->total = Money::EUR(2500); $order->status = OrderStatus::VALIDATED; $order->pickup_day = now()->addDays(2); $order->shop_id = $shop->id; $order->delivery_address = new DeliveryAddress( name: $shop->name, address: $shop->address, postcode: $shop->postcode, city: $shop->city, ); $order->employee = new OrderEmployee( matricule: new Matricule('1234567'), firstname: 'Jean', lastname: 'Dupont', facility: new ShopperEstablishmentCode('FAC01'), site: new ShopperSiteCode('SITE'), service: new ShopperServiceCode('101'), ); $order->save(); $query = new GetTunnelOrderConfirmedQuery(new MapUrlService()); $input = new GetTunnelOrderConfirmedQueryInput($order); // WHEN $output = $query($input); // THEN expect($output->step)->toBe(OrderTunnelStep::CONFIRMATION) ->and((string) $output->order->reference)->toBe((string) $reference) ->and($output->shop->name)->toBe('Boutique Retrait'); }); it('throws UnexpectedValueException when order has no shop', function (): void { // GIVEN $reference = new OrderReference(UuidHelper::v7()); $order = new Order(); $order->reference = $reference; $order->total = Money::EUR(2500); $order->status = OrderStatus::VALIDATED; $order->pickup_day = now()->addDays(2); $order->shop_id = null; $order->employee = new OrderEmployee( matricule: new Matricule('1234567'), firstname: 'Jean', lastname: 'Dupont', facility: new ShopperEstablishmentCode('FAC01'), site: new ShopperSiteCode('SITE'), service: new ShopperServiceCode('101'), ); $order->delivery_address = new DeliveryAddress( name: 'Nom', address: '1 rue Test', postcode: '75001', city: 'Paris', ); $order->save(); $query = new GetTunnelOrderConfirmedQuery(new MapUrlService()); $input = new GetTunnelOrderConfirmedQueryInput($order); // WHEN & THEN expect(fn () => $query($input))->toThrow(\UnexpectedValueException::class); }); });