create(new CreateSetDto( name: 'Baderech HaAvodah', description: 'A structured path for growth', iconImageUrl: '/assets/baderech-haavodah-icon.png', )); $element = $elementRepository->create(new CreateElementDto( set: $set, title: 'Baderech HaAvodah', description: 'A structured path for growth', richText: '
A structured path for growth
', pdfPath: '/assets/pdfs/baderech.pdf', parentElement: null, )); $firstChildElement = $elementRepository->create(new CreateElementDto( set: $set, title: 'Avodah Foundations', description: 'Foundations for steady avodah', richText: 'Foundations rich text
', pdfPath: '/assets/pdfs/foundations.pdf', parentElement: $element, )); $secondChildElement = $elementRepository->create(new CreateElementDto( set: $set, title: 'Daily Practice', description: 'Daily practices for growth', richText: 'Daily practice rich text
', pdfPath: null, parentElement: $element, )); $response = $this->getJson("/api/elements/{$element->getId()}"); $response->assertOk(); $response->assertExactJson([ 'childElements' => [ [ 'id' => $firstChildElement->getId(), 'title' => 'Avodah Foundations', 'description' => 'Foundations for steady avodah', ], [ 'id' => $secondChildElement->getId(), 'title' => 'Daily Practice', 'description' => 'Daily practices for growth', ], ], 'element' => [ 'id' => $element->getId(), 'title' => 'Baderech HaAvodah', 'description' => 'A structured path for growth', 'richText' => 'A structured path for growth
', 'pdfPath' => '/assets/pdfs/baderech.pdf', ], ]); } public function testReturns404WhenElementDoesNotExist(): void { $response = $this->getJson('/api/elements/999'); $response->assertNotFound(); $response->assertExactJson([ 'error' => 'Element not found', ]); } }