test element siblings
This commit is contained in:
parent
90d28deffb
commit
eb868679c8
3 changed files with 258 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue