diff --git a/tests/Fakes/FakeTextRepository.php b/tests/Fakes/FakeTextRepository.php index 7dac270..3e556a2 100644 --- a/tests/Fakes/FakeTextRepository.php +++ b/tests/Fakes/FakeTextRepository.php @@ -19,6 +19,7 @@ class FakeTextRepository implements TextRepository $text = new Text( id: $id, name: $dto->name, + user: $dto->user, ); $this->existingTexts[$id] = $text; @@ -27,19 +28,15 @@ class FakeTextRepository implements TextRepository public function find(int $id): ?Text { - $text = array_find( - $this->existingTexts, - function (Text $text) use ($id) { - return $text->getId() === $id; - } - ); - if ($text === null) { + if (!isset($this->existingTexts[$id])) { return null; } + $text = $this->existingTexts[$id]; return new Text( - id: $id, + id: $text->getId(), name: $text->getName(), + user: $text->getUser(), ); } @@ -58,9 +55,10 @@ class FakeTextRepository implements TextRepository return new Text( id: $text->getId(), name: $text->getName(), + user: $text->getUser(), ); }, - $this->existingTexts + array_values($this->existingTexts) ); } }