<?php

namespace MintyPHP\Tests\Service\Audit;

use MintyPHP\Service\Audit\NullAuditMetadataEnricher;
use PHPUnit\Framework\TestCase;

class NullAuditMetadataEnricherTest extends TestCase
{
    public function testEnrichDoesNotModifyEntity(): void
    {
        $enricher = new NullAuditMetadataEnricher();
        $entity = ['created_by' => 10, 'modified_by' => 20, 'name' => 'Test'];

        $enricher->enrich($entity);

        $this->assertSame(['created_by' => 10, 'modified_by' => 20, 'name' => 'Test'], $entity);
        $this->assertArrayNotHasKey('created_by_label', $entity);
        $this->assertArrayNotHasKey('modified_by_label', $entity);
    }

    public function testEnrichWithCustomFieldsDoesNotModifyEntity(): void
    {
        $enricher = new NullAuditMetadataEnricher();
        $entity = ['status_changed_by' => 5];

        $enricher->enrich($entity, ['status_changed_by']);

        $this->assertSame(['status_changed_by' => 5], $entity);
        $this->assertArrayNotHasKey('status_changed_by_label', $entity);
    }
}
