scheduled node repo with create method

This commit is contained in:
Yisroel Baum 2026-02-23 22:40:15 +02:00
parent 5bb5bf0c47
commit 49328404c9
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,29 @@
<?php
namespace Tests\Fakes;
use App\ScheduledNode\CreateScheduledNodeDto;
use App\ScheduledNode\ScheduledNode;
use App\ScheduledNode\ScheduledNodeRepository;
class FakeScheduledNodeRepository implements ScheduledNodeRepository
{
private array $existingScheduledNodes = [];
public function create(CreateScheduledNodeDto $dto): ScheduledNode
{
$id = $this->nextId();
$scheduledNode = new ScheduledNode(
id: $id,
date: $dto->date,
);
$this->existingScheduledNodes[$id] = $scheduledNode;
return $scheduledNode;
}
public function nextId(): int
{
return count($this->existingScheduledNodes);
}
}