<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class DetailPageFormContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testScopedDetailFormsUseStandardDetailOptInAttribute(): void
    {
        foreach (DetailPageContractFiles::standardDetailFormFiles() as $file) {
            $content = $this->readProjectFile($file);
            $this->assertStringContainsString('data-standard-detail-form="1"', $content, $file);
        }
    }

    public function testImportsWizardFormsUseStandardDetailOptIn(): void
    {
        $content = $this->readProjectFile('pages/admin/imports/index(default).phtml');

        $this->assertStringContainsString('id="imports-upload-form"', $content);
        $this->assertStringContainsString('id="imports-mapping-form"', $content);
        $this->assertStringContainsString('id="imports-commit-form"', $content);
        $this->assertSame(3, substr_count($content, 'data-standard-detail-form="1"'));
    }
}
