test find elements by set

This commit is contained in:
Yisroel Baum 2026-05-25 08:11:25 +03:00
parent 24fce56c5e
commit aaa494afe4
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
2 changed files with 4 additions and 3 deletions

View file

@ -5,6 +5,7 @@ namespace Tests\Fakes;
use App\Element\CreateElementDto;
use App\Element\Element;
use App\Element\ElementRepository;
use App\Set\Set as DomainSet;
class FakeElementRepository implements ElementRepository
{
@ -39,11 +40,11 @@ class FakeElementRepository implements ElementRepository
/**
* @return Element[]
*/
public function findBySetId(int $id): array
public function findBySet(DomainSet $set): array
{
$elements = [];
foreach ($this->elementsById as $element) {
if ($element->getSet()->getId() === $id) {
if ($element->getSet()->getId() === $set->getId()) {
$elements[] = $this->cloneElement($element);
}
}

View file

@ -45,7 +45,7 @@ class CreateSetTest extends TestCase
new CreateSetRequest('Daily learning')
);
$elements = $this->elementRepo->findBySetId($set->getId());
$elements = $this->elementRepo->findBySet($set);
$this->assertCount(1, $elements);
$this->assertSame('Daily learning', $elements[0]->getTitle());