test element descriptions

This commit is contained in:
Yisroel Baum 2026-05-26 21:10:42 +03:00
parent a317f24976
commit f2dc1483dd
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 80 additions and 1 deletions

View file

@ -30,6 +30,7 @@ class GetElementTest extends TestCase
$element = $this->createElement(
$set,
'Baderech HaAvodah',
'A structured path for growth',
null,
);
@ -41,6 +42,10 @@ class GetElementTest extends TestCase
$this->assertInstanceOf(Element::class, $foundElement);
$this->assertSame($element->getId(), $foundElement->getId());
$this->assertSame('Baderech HaAvodah', $foundElement->getTitle());
$this->assertSame(
'A structured path for growth',
$foundElement->getDescription(),
);
}
public function testReturnsDirectChildElements(): void
@ -49,32 +54,38 @@ class GetElementTest extends TestCase
$parentElement = $this->createElement(
$set,
'Baderech HaAvodah',
'A structured path for growth',
null,
);
$firstChildElement = $this->createElement(
$set,
'Avodah Foundations',
'Foundations for steady avodah',
$parentElement,
);
$secondChildElement = $this->createElement(
$set,
'Daily Practice',
'Daily practices for growth',
$parentElement,
);
$this->createElement(
$set,
'Nested Practice',
'Nested description',
$firstChildElement,
);
$otherSet = $this->createSet(2, 'Daily Learning');
$otherParentElement = $this->createElement(
$otherSet,
'Other Parent',
'Other parent description',
null,
);
$this->createElement(
$otherSet,
'Other Child',
'Other child description',
$otherParentElement,
);
@ -89,11 +100,19 @@ class GetElementTest extends TestCase
$childElements[0]->getId(),
);
$this->assertSame('Avodah Foundations', $childElements[0]->getTitle());
$this->assertSame(
'Foundations for steady avodah',
$childElements[0]->getDescription(),
);
$this->assertSame(
$secondChildElement->getId(),
$childElements[1]->getId(),
);
$this->assertSame('Daily Practice', $childElements[1]->getTitle());
$this->assertSame(
'Daily practices for growth',
$childElements[1]->getDescription(),
);
}
public function testThrowsWhenIdMissing(): void
@ -125,11 +144,13 @@ class GetElementTest extends TestCase
private function createElement(
DomainSet $set,
string $title,
string $description,
?Element $parentElement,
): Element {
return $this->elementRepo->create(new CreateElementDto(
set: $set,
title: $title,
description: $description,
parentElement: $parentElement,
));
}