<?php

namespace MintyPHP\Tests\Architecture;

use PHPUnit\Framework\TestCase;

final class DetailActionPolicyMigrationContractTest extends TestCase
{
    use ProjectFileAssertionSupport;

    public function testMigratedFilesNoLongerUseInlineConfirmHandlers(): void
    {
        foreach (DetailActionPolicyContractFiles::migratedConfirmFiles() as $file) {
            $content = $this->readProjectFile($file);
            $this->assertStringNotContainsString('onsubmit="return confirm(', $content, $file);
            $this->assertStringNotContainsString('onclick="return confirm(', $content, $file);
        }
    }

    public function testMigratedFilesExposeDataDetailConfirmContract(): void
    {
        foreach (DetailActionPolicyContractFiles::migratedConfirmFiles() as $file) {
            $content = $this->readProjectFile($file);
            $this->assertStringContainsString('data-detail-confirm-message', $content, $file);
        }
    }
}
