templatesDir = __DIR__ . '/fixtures'; } public function testRenderSignature(): void { $engine = new Engine(); $this->assertTrue(method_exists($engine, 'render')); } public function testThrowsTemplateNotFoundExceptionInDebug(): void { $this->expectException(TemplateNotFoundException::class); $engine = new Engine(['mode' => 'debug']); $engine->render('missing.template'); } public function testRendersPlaceholderInProduction(): void { $engine = new Engine(['mode' => 'production']); $output = $engine->render('missing.template'); $this->assertEquals("", $output); } public function testRenders404Fallback(): void { file_put_contents($this->templatesDir . '/404.scape.php', 'Custom 404: {{ missing_template }}'); $engine = new Engine(['templates_dir' => $this->templatesDir, 'mode' => 'production']); $output = $engine->render('missing.template'); $this->assertEquals('Custom 404: missing.template', $output); unlink($this->templatesDir . '/404.scape.php'); } public function testRendersSimpleTemplate(): void { $engine = new Engine([ 'templates_dir' => $this->templatesDir, 'mode' => 'production' ]); $output = $engine->render('tests.simple', [ 'name' => 'Funky', 'items' => ['Apple', 'Banana'] ]); $expected = "Hello Funky!\n - Apple\n - Banana\n"; $this->assertEquals($expected, $output); } public function testRendersTemplateWithInheritance(): void { $engine = new Engine([ 'templates_dir' => $this->templatesDir, 'layouts_dir' => $this->templatesDir . '/layouts', 'mode' => 'production' ]); $output = $engine->render('tests.child', [ 'name' => 'Funky' ]); $this->assertStringContainsString('