<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class AuthLoginFieldAccessibilityContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testAuthLoginFormsExposeErrorDescriptionForInputs(): void
    {
        $describedByPattern = '/aria-describedby="[^"]*\\$errorNoticeId[^"]*"/';

        foreach (AuthLoginAccessibilityContractFiles::authLoginTemplates() as $file) {
            $content = $this->readProjectFile($file);
            $this->assertMatchesRegularExpression($describedByPattern, $content, $file);
            $this->assertStringContainsString('aria-invalid="true"', $content, $file);
        }
    }
}
