plan repo with create method

This commit is contained in:
Yisroel Baum 2026-02-23 10:41:06 +02:00
parent 957de13e71
commit de744c9b15
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,29 @@
<?php
namespace Tests\Fakes;
use App\Plan\CreatePlanDto;
use App\Plan\Plan;
use App\Plan\PlanRepository;
class FakePlanRepository implements PlanRepository
{
private array $existingPlans = [];
public function create(CreatePlanDto $dto): Plan
{
$id = $this->nextId();
$plan = new Plan(
id: $id,
name: $dto->name,
);
$this->existingPlans[$id] = $plan;
return $plan;
}
private function nextId(): int
{
return count($this->existingPlans);
}
}