test set creation repo

This commit is contained in:
Yisroel Baum 2026-05-25 08:36:16 +03:00
parent f58cf050e3
commit 4897cc2e20
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 29 additions and 20 deletions

View file

@ -2,6 +2,7 @@
namespace Tests\Fakes;
use App\Set\CreateSetDto;
use App\Set\Set as DomainSet;
use App\Set\SetRepository;
@ -12,9 +13,16 @@ class FakeSetRepository implements SetRepository
*/
private array $setsById = [];
public function store(DomainSet $set): void
public function create(CreateSetDto $dto): DomainSet
{
$this->setsById[$set->getId()] = $set;
$id = count($this->setsById) + 1;
$set = new DomainSet(
id: $id,
name: $dto->name,
);
$this->setsById[$id] = $set;
return $set;
}
public function find(int $id): ?DomainSet