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

34 lines
892 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 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);
});
});