<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class AuthHelpLinksPageContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testLoginTemplateDefinesStageSpecificLinkMatrix(): void
    {
        $content = $this->readProjectFile('pages/auth/login(login).phtml');

        $this->assertStringContainsString("'show_register' => true", $content);
        $this->assertStringContainsString('\'show_forgot\' => !empty($selectedTenantMethods[\'local\'])', $content);
        $this->assertStringContainsString('$stage === \'choose_tenant\'', $content);
    }

    public function testSecondaryAuthPagesProvideBackToLoginLink(): void
    {
        foreach (AuthHelpLinksContractFiles::secondaryAuthPages() as $file) {
            $content = $this->readProjectFile($file);
            $this->assertStringContainsString("'show_back_to_login' => true", $content, $file);
            $this->assertStringContainsString("templatePath('partials/auth-help-links.phtml')", $content, $file);
        }
    }
}
