Your IP : 216.73.217.79


Current Path : /var/www/v3.cesa.co.za/tests/Unit/
Upload File :
Current File : /var/www/v3.cesa.co.za/tests/Unit/TransformationPortalHelpersTest.php

<?php

namespace App\Tests\Unit;

use App\MemberBundle\Form\TransformationReportingChoices;
use App\MemberBundle\Service\MemberFirmTransformationPortalService;
use PHPUnit\Framework\TestCase;

class TransformationPortalHelpersTest extends TestCase
{
    public function testNormalizeEmailTrimsAndLowercases(): void
    {
        $this->assertSame('a@b.co', MemberFirmTransformationPortalService::normalizeEmail('  A@B.CO  '));
        $this->assertSame('', MemberFirmTransformationPortalService::normalizeEmail(''));
        $this->assertSame('', MemberFirmTransformationPortalService::normalizeEmail(null));
    }

    public function testMergeStoredValueAppendsUnknownOption(): void
    {
        $base = ['A' => 'a', 'B' => 'b'];
        $merged = TransformationReportingChoices::mergeStoredValue($base, 'legacy');
        $this->assertArrayHasKey('legacy (on file)', $merged);
        $this->assertSame('legacy', $merged['legacy (on file)']);
    }

    public function testMergeStoredValueSkipsWhenValueExists(): void
    {
        $base = ['A' => 'a'];
        $merged = TransformationReportingChoices::mergeStoredValue($base, 'a');
        $this->assertCount(1, $merged);
    }

    public function testTransformationFieldCountMatchesEntityGrid(): void
    {
        // Seven occupational bands × ten demographic columns (MA..MN, FA..FN)
        $this->assertCount(70, MemberFirmTransformationPortalService::TRANSFORMATION_COUNT_FIELDS);
    }
}