34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Queries\Orders\GetBasketSummaryQuery;
|
|
use App\Queries\Orders\GetBasketSummaryQueryInput;
|
|
use App\Queries\Orders\GetBasketSummaryQueryOutput;
|
|
use Domain\Enums\OrderTunnelStep;
|
|
use Domain\Models\Entities\Basket;
|
|
use Domain\Models\ValueObjects\Entities\BasketId;
|
|
use Domain\Services\BasketService;
|
|
use Ramsey\Uuid\Uuid;
|
|
|
|
describe('GetBasketSummaryQuery', function (): void {
|
|
it('returns basket summary output with step REVIEW and basket', function (): void {
|
|
// GIVEN
|
|
$basket = new Basket(new BasketId(Uuid::uuid7()));
|
|
$basketService = \Mockery::mock(BasketService::class);
|
|
$basketService->shouldReceive('getBasket')
|
|
->once()
|
|
->andReturn($basket);
|
|
|
|
$query = new GetBasketSummaryQuery($basketService);
|
|
$input = new GetBasketSummaryQueryInput();
|
|
|
|
// WHEN
|
|
$output = $query($input);
|
|
|
|
// THEN
|
|
expect($output)->toBeInstanceOf(GetBasketSummaryQueryOutput::class)
|
|
->and($output->step)->toBe(OrderTunnelStep::REVIEW)
|
|
->and($output->basket)->toBe($basket);
|
|
});
|
|
});
|