- Entra admin roles scan job (ScanEntraAdminRolesJob) - Report service with fingerprint deduplication - Finding generator with high-privilege role catalog - Admin roles summary widget on tenant view page - Alert integration for entra.admin_roles findings - Graph contracts for roleDefinitions + roleAssignments - Entra permissions registry (config/entra_permissions.php) - StoredReport fingerprint migration - OperationCatalog label + duration for entra.admin_roles.scan - SummaryCountsNormalizer: filter zeros, humanize keys globally - 11 new test files (71+ tests, 286+ assertions) - Spec + tasks + checklist updates
65 lines
1.6 KiB
PHP
65 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\OpsUx\SummaryCountsNormalizer;
|
|
|
|
it('normalizes allowed keys and casts to int', function () {
|
|
$result = SummaryCountsNormalizer::normalize([
|
|
'total' => 5,
|
|
'processed' => '3',
|
|
'failed' => 0,
|
|
'bogus_key' => 99,
|
|
]);
|
|
|
|
expect($result)->toBe([
|
|
'total' => 5,
|
|
'processed' => 3,
|
|
'failed' => 0,
|
|
]);
|
|
});
|
|
|
|
it('strips empty string keys and non-numeric values', function () {
|
|
$result = SummaryCountsNormalizer::normalize([
|
|
'' => 1,
|
|
'total' => 'not-a-number',
|
|
'succeeded' => 10,
|
|
]);
|
|
|
|
expect($result)->toBe(['succeeded' => 10]);
|
|
});
|
|
|
|
it('renders summary line with only non-zero values', function () {
|
|
$line = SummaryCountsNormalizer::renderSummaryLine([
|
|
'report_created' => 0,
|
|
'report_deduped' => 1,
|
|
'findings_created' => 0,
|
|
'findings_unchanged' => 10,
|
|
'alert_events_produced' => 0,
|
|
]);
|
|
|
|
expect($line)->toBe('Report deduped: 1 · Findings unchanged: 10');
|
|
});
|
|
|
|
it('returns null when all values are zero', function () {
|
|
$line = SummaryCountsNormalizer::renderSummaryLine([
|
|
'report_created' => 0,
|
|
'findings_created' => 0,
|
|
]);
|
|
|
|
expect($line)->toBeNull();
|
|
});
|
|
|
|
it('returns null for empty array', function () {
|
|
expect(SummaryCountsNormalizer::renderSummaryLine([]))->toBeNull();
|
|
});
|
|
|
|
it('humanizes snake_case keys to Title case', function () {
|
|
$line = SummaryCountsNormalizer::renderSummaryLine([
|
|
'high' => 3,
|
|
'alert_events_produced' => 2,
|
|
]);
|
|
|
|
expect($line)->toBe('High: 3 · Alert events produced: 2');
|
|
});
|