36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Actions\Orders\InitializeOrderTunnel;
|
|
use App\Actions\Orders\InitializeOrderTunnelInput;
|
|
use Domain\Models\Entities\Basket;
|
|
use Domain\Models\ValueObjects\Entities\BasketId;
|
|
use Domain\Models\ValueObjects\Entities\ShopperId;
|
|
use Domain\Services\OrderTunnelService;
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
describe('InitializeOrderTunnel', function (): void {
|
|
it('initializes the tunnel from basket via OrderTunnelService', function (): void {
|
|
// GIVEN
|
|
$basket = new Basket(new BasketId(Uuid::uuid7()));
|
|
$shopperId = new ShopperId(Uuid::uuid7());
|
|
$input = new InitializeOrderTunnelInput(
|
|
basket: $basket,
|
|
shopperId: $shopperId,
|
|
);
|
|
|
|
$orderTunnelService = \Mockery::mock(OrderTunnelService::class);
|
|
$orderTunnelService->shouldReceive('initializeFromBasket')
|
|
->once()
|
|
->with($basket, $shopperId);
|
|
|
|
$action = new InitializeOrderTunnel($orderTunnelService);
|
|
|
|
// WHEN
|
|
$action($input);
|
|
|
|
// THEN
|
|
expect(true)->toBeTrue();
|
|
});
|
|
});
|