Refactored the codebase to change the namespaces of various actions and queries from `App\Actions` to `App\Cqs\Actions` and `App\Queries` to `App\Cqs\Queries`. This restructuring improves organization and clarity in the codebase.
33 lines
892 B
PHP
33 lines
892 B
PHP
<?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);
|
|
});
|
|
});
|