ldc-cocotte/tests/Unit/App/Actions/ProductIncos/AssociateProductIncoInputTest.php

35 lines
987 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace Tests\Unit\App\Cqs\Actions\ProductIncos;
use App\Cqs\Actions\ProductIncos\AssociateProductIncoInput;
use Domain\Models\ValueObjects\Entities\ProductId;
use Ramsey\Uuid\Uuid;
describe('AssociateProductIncoInput', function (): void {
it('creates input successfully with valid parameters', function (): void {
// GIVEN
$productId = new ProductId(Uuid::uuid7());
$noArt = 27996;
// WHEN
$input = new AssociateProductIncoInput($productId, $noArt);
// THEN
expect($input->productId)->toBe($productId)
->and($input->no_art)->toBe(27996);
});
it('throws when no_art is less than 1', function (): void {
// GIVEN
$productId = new ProductId(Uuid::uuid7());
$noArt = 0;
// WHEN & THEN
expect(fn () => new AssociateProductIncoInput($productId, $noArt))
->toThrow(\InvalidArgumentException::class);
});
});