2026-10-03 10:54:52 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
namespace Tests\Unit\App\Cqs\Actions\ProductIncos;
|
2026-10-03 10:54:52 +02:00
|
|
|
|
2026-11-10 14:28:00 +01:00
|
|
|
use App\Cqs\Actions\ProductIncos\AssociateProductIncoInput;
|
2026-10-03 10:54:52 +02:00
|
|
|
use App\Models\Product;
|
|
|
|
|
|
|
|
|
|
describe('AssociateProductIncoInput', function (): void {
|
|
|
|
|
it('creates input successfully with valid parameters', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$product = new Product();
|
|
|
|
|
$noArt = 27996;
|
|
|
|
|
|
|
|
|
|
// WHEN
|
|
|
|
|
$input = new AssociateProductIncoInput($product, $noArt);
|
|
|
|
|
|
|
|
|
|
// THEN
|
|
|
|
|
expect($input->product)->toBe($product)
|
|
|
|
|
->and($input->no_art)->toBe(27996);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('throws when no_art is less than 1', function (): void {
|
|
|
|
|
// GIVEN
|
|
|
|
|
$product = new Product();
|
|
|
|
|
$noArt = 0;
|
|
|
|
|
|
|
|
|
|
// WHEN & THEN
|
|
|
|
|
expect(fn () => new AssociateProductIncoInput($product, $noArt))
|
|
|
|
|
->toThrow(\InvalidArgumentException::class);
|
|
|
|
|
});
|
|
|
|
|
});
|