preprocessor = new TemplatePreprocessor();
}
public function testPreprocessesBladeTemplate(): void
{
$blade = "
\n@if(true)\n
{{ title }}
\n@endif\n";
$processed = $this->preprocessor->preprocess($blade, 'views/user.blade.php');
$this->assertStringNotContainsString('@if', $processed);
$this->assertStringNotContainsString('{{', $processed);
$this->assertStringContainsString('', $processed);
// Verify line count is preserved
$this->assertSame(substr_count($blade, "\n"), substr_count($processed, "\n"));
}
public function testPreprocessesTwigTemplate(): void
{
$twig = "\n{% if logged_in %}\n
{{ user.email }}
\n{% endif %}\n
";
$processed = $this->preprocessor->preprocess($twig, 'templates/user.twig');
$this->assertStringNotContainsString('{%', $processed);
$this->assertStringNotContainsString('{{', $processed);
$this->assertStringContainsString('
', $processed);
// Verify line count is preserved
$this->assertSame(substr_count($twig, "\n"), substr_count($processed, "\n"));
}
public function testPreprocessesPhpTemplate(): void
{
$php = "
\n\n\n\n
";
$processed = $this->preprocessor->preprocess($php, 'views/button.php');
$this->assertStringNotContainsString('assertStringNotContainsString('=', $processed);
$this->assertStringContainsString('