<?php

namespace Tests\Feature;

use Illuminate\Support\Facades\Blade;
use Tests\TestCase;

class FrameworkBladeSafetyTest extends TestCase
{
    public function test_framework_style_blade_conditionals_compile_without_application_rewrites(): void
    {
        $template = <<<'BLADE'
@if (true)
    <section title="Exception details">
        @if (false)
            <span>Hidden</span>
        @else
            <span>Visible</span>
        @endif
    </section>
@endif
BLADE;

        $compiled = Blade::compileString($template);

        $this->assertStringContainsString('<?php if(true): ?>', $compiled);
        $this->assertSame(2, substr_count($compiled, '<?php endif; ?>'));
        $this->assertStringContainsString('title="Exception details"', $compiled);
    }
}
