test set creation repo
This commit is contained in:
parent
f58cf050e3
commit
4897cc2e20
2 changed files with 29 additions and 20 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue