add element updates
This commit is contained in:
parent
6d0acaae56
commit
73b0befc97
10 changed files with 223 additions and 13 deletions
|
|
@ -5,6 +5,7 @@ namespace Tests\Fakes;
|
|||
use App\Element\CreateElementDto;
|
||||
use App\Element\Element;
|
||||
use App\Element\ElementRepository;
|
||||
use App\Element\UpdateElementDto;
|
||||
use App\Set\Set as DomainSet;
|
||||
|
||||
class FakeElementRepository implements ElementRepository
|
||||
|
|
@ -33,6 +34,24 @@ class FakeElementRepository implements ElementRepository
|
|||
return $element;
|
||||
}
|
||||
|
||||
public function update(Element $element, UpdateElementDto $dto): Element
|
||||
{
|
||||
$updatedElement = new Element(
|
||||
id: $element->getId(),
|
||||
title: $dto->title,
|
||||
description: $dto->description,
|
||||
iconImageUrl: $dto->iconImageUrl,
|
||||
richText: $dto->richText,
|
||||
pdfPath: $dto->pdfPath,
|
||||
youtubeUrl: $dto->youtubeUrl,
|
||||
set: $element->getSet(),
|
||||
parentElement: $element->getParentElement(),
|
||||
);
|
||||
$this->elementsById[$element->getId()] = $updatedElement;
|
||||
|
||||
return $this->cloneElement($updatedElement);
|
||||
}
|
||||
|
||||
public function find(int $id): ?Element
|
||||
{
|
||||
if (! isset($this->elementsById[$id])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue