<?php

use App\Services\WorkflowGuardService;
use CodeIgniter\Test\CIUnitTestCase;
use Config\Database;

/**
 * @internal
 */
final class SmokeWorkflowChainTest extends CIUnitTestCase
{
    public function testWorkOrderStatusTransitionChain(): void
    {
        $guard = new WorkflowGuardService(Database::connect());

        $this->assertTrue($guard->canTransition('new', 'assigned'));
        $this->assertTrue($guard->canTransition('assigned', 'in_progress'));
        $this->assertTrue($guard->canTransition('in_progress', 'completed'));
        $this->assertFalse($guard->canTransition('new', 'completed'));
    }

    public function testPettyCashStatusEnumDocumentedInMigration(): void
    {
        $path = APPPATH . 'Database/Migrations/2026-05-23-100000_FullModuleParity.php';
        $this->assertFileExists($path);
        $content = file_get_contents($path);
        $this->assertStringContainsString('reconciliation', $content);
        $this->assertStringContainsString('issued', $content);
    }
}
