major update

This commit is contained in:
2026-03-04 15:56:58 +01:00
parent 16759a2732
commit 8f4dd5840d
478 changed files with 24313 additions and 8201 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace MintyPHP\Tests\Service\Audit;
use MintyPHP\Service\Audit\SystemAuditRedactionService;
use PHPUnit\Framework\TestCase;
class SystemAuditRedactionServiceTest extends TestCase
{
public function testSensitiveKeysAreRedacted(): void
{
$service = new SystemAuditRedactionService();
$redacted = $service->redactMetadata([
'email' => 'john@example.com',
'token' => 'abc',
'active' => 1,
'nested' => ['password' => 'secret'],
]);
$this->assertSame('[REDACTED]', $redacted['email']);
$this->assertSame('[REDACTED]', $redacted['token']);
$this->assertSame(1, $redacted['active']);
$this->assertSame('[REDACTED]', $redacted['nested']['password']);
}
public function testBuildChangeSetUsesAllowlistAndRedactsOtherValues(): void
{
$service = new SystemAuditRedactionService();
$changeSet = $service->buildChangeSet(
['active' => 0, 'description' => 'old'],
['active' => 1, 'description' => 'new']
);
$this->assertSame(['active', 'description'], $changeSet['changed_fields']);
$this->assertSame(0, $changeSet['changes']['active']['before']);
$this->assertSame(1, $changeSet['changes']['active']['after']);
$this->assertSame('[REDACTED]', $changeSet['changes']['description']['before']);
$this->assertSame('[REDACTED]', $changeSet['changes']['description']['after']);
}
}