From 53f0dfc1ed2ad3cfbfce8f2c9f06639f5214b34f Mon Sep 17 00:00:00 2001 From: Yisroel Baum Date: Wed, 27 May 2026 21:37:18 +0300 Subject: [PATCH] test demo seed data --- backend/tests/Feature/DemoSeedDataTest.php | 87 ++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 backend/tests/Feature/DemoSeedDataTest.php diff --git a/backend/tests/Feature/DemoSeedDataTest.php b/backend/tests/Feature/DemoSeedDataTest.php new file mode 100644 index 0000000..f1c07a2 --- /dev/null +++ b/backend/tests/Feature/DemoSeedDataTest.php @@ -0,0 +1,87 @@ +seed(DatabaseSeeder::class); + + $setRepository = app(SetRepository::class); + $elementRepository = app(ElementRepository::class); + $baderechSet = $setRepository->find(1); + $rootElement = $elementRepository->findRootBySet($baderechSet); + $childElements = $elementRepository->findByParentElement($rootElement); + + $this->assertSame('', $rootElement->getRichText()); + $this->assertNull($rootElement->getYoutubeUrl()); + $this->assertCount(6, $childElements); + $this->assertSame( + [ + [ + 'title' => 'Introduction', + 'description' => 'Your beliefs influence your thinking, ' + . 'and your thinking drives your choices. When you ' + . 'nurture healthy beliefs - about yourself, about ' + . 'the Creator, and about the meaning of life - you ' + . 'unlock the ability to live with strength, ' + . 'confidence, and hope.', + ], + [ + 'title' => 'Foundations', + 'description' => 'Focal points for thriving in a chaotic ' + . 'world. In this fast, complex era, you flourish ' + . 'when you develop clarity, well-being, resilience, ' + . 'and the ability to uplift the physical world with ' + . 'spiritual intention.', + ], + [ + 'title' => 'Divine Plan', + 'description' => 'Understanding the unique greatness of ' + . 'our generation and the call to remain hopeful, ' + . 'optimistic, and resilient.', + ], + [ + 'title' => 'Architecture of the Soul', + 'description' => "Becoming a Baal Da'at - A Master of " + . 'Inner Awareness', + ], + [ + 'title' => 'Arba Yesodot', + 'description' => 'A structured approach to balanced ' + . 'living: Physical & Financial Health, ' + . 'Relationships, Wisdom and Guidance.', + ], + [ + 'title' => 'Fluid Integration', + 'description' => 'A series of practical exercises to ' + . 'engender a shift in mindset, embed healthy ' + . 'routines, positive life practices.', + ], + ], + $this->serializeChildElements($childElements), + ); + } + + private function serializeChildElements(array $childElements): array + { + $serializedChildElements = []; + foreach ($childElements as $childElement) { + $serializedChildElements[] = [ + 'title' => $childElement->getTitle(), + 'description' => $childElement->getDescription(), + ]; + } + + return $serializedChildElements; + } +}