'heading', 'data' => ['text' => 'Hello World'] ], [ 'type' => 'text', 'data' => ['text' => '

This is a paragraph.

'] ] ]; $html = $renderer->render($content); $this->assertStringContainsString('

Hello World

', $html); $this->assertStringContainsString('

This is a paragraph.

', $html); } public function test_it_supports_theme_overrides(): void { // Setup theme blocks directory $themesPath = base_path('themes'); if (! File::exists($themesPath)) { File::makeDirectory($themesPath); } $themeBlocksPath = "{$themesPath}/test-theme/blocks"; if (! File::exists($themeBlocksPath)) { File::makeDirectory($themeBlocksPath, 0755, true); } File::put("{$themeBlocksPath}/heading.blade.php", "

{{ \$text }}

"); // Add theme to view paths View::addNamespace('themes.test-theme', $themesPath . '/test-theme'); Config::set('cms.theme', 'test-theme'); $renderer = new PageRenderer(); $content = [ ['type' => 'heading', 'data' => ['text' => 'Theme Heading']] ]; $html = $renderer->render($content); $this->assertStringContainsString("

Theme Heading

", $html); // Cleanup File::deleteDirectory($themesPath . '/test-theme'); } public function test_it_handles_missing_blocks_gracefully(): void { $renderer = new PageRenderer(); $content = [ ['type' => 'unknown', 'data' => []] ]; $html = $renderer->render($content); $this->assertStringContainsString('', $html); } } EOF; file_put_contents('tests/Unit/PageRendererTest.php', $content);