ldc-boutique-cnc-sable/tests/Unit/App/Actions/Common/ChangeModelOrderInputTest.php

32 lines
865 B
PHP
Raw Permalink Normal View History

<?php
declare(strict_types=1);
use App\Actions\Common\ChangeModelOrderInput;
use App\Interfaces\ModelWithOrder;
use Illuminate\Database\Eloquent\Model;
describe('ChangeModelOrderInput', function (): void {
it('can be instantiated with a model implementing ModelWithOrder and a SortDirection', function (): void {
// GIVEN
$mock = new class () extends Model implements ModelWithOrder
{
public function getOrder(): int
{
return 1;
}
public function setOrder(int $order): void
{
}
};
// WHEN
$input = new ChangeModelOrderInput(model: $mock, direction: \SortDirection::Ascending);
// THEN
expect($input->model)->toBe($mock)
->and($input->direction)->toBe(\SortDirection::Ascending);
});
});