test element siblings

This commit is contained in:
Yisroel Baum 2026-06-21 22:36:29 +03:00
parent 90d28deffb
commit eb868679c8
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
3 changed files with 258 additions and 0 deletions

View file

@ -150,6 +150,68 @@ class ElementControllerTest extends TestCase
'description' => 'Daily practices for growth',
],
], $body['childElements']);
$this->assertSame([
[
'id' => $element->getId(),
'title' => 'Baderech HaAvodah',
'description' => 'A structured path for growth',
],
], $body['siblingElements']);
}
public function testShowReturnsSameParentSiblingPayload(): void
{
$set = $this->createSet(1, 'Baderech');
$parentElement = $this->createElement(
$set,
'Baderech HaAvodah',
'A structured path for growth',
null,
'',
null,
null,
null,
null,
);
$firstChildElement = $this->createElement(
$set,
'Avodah Foundations',
'Foundations for steady avodah',
null,
'<p>Foundations rich text</p>',
null,
null,
null,
$parentElement,
);
$secondChildElement = $this->createElement(
$set,
'Daily Practice',
'Daily practices for growth',
null,
'',
null,
null,
null,
$parentElement,
);
$response = $this->controller->show($firstChildElement->getId());
$this->assertEquals(200, $response->getStatusCode());
$body = json_decode($response->getContent(), true);
$this->assertSame([
[
'id' => $firstChildElement->getId(),
'title' => 'Avodah Foundations',
'description' => 'Foundations for steady avodah',
],
[
'id' => $secondChildElement->getId(),
'title' => 'Daily Practice',
'description' => 'Daily practices for growth',
],
], $body['siblingElements']);
}
public function testShowReturns400WhenIdMissing(): void