test: add comprehensive tests for AuditLogService #2

Open
Charon wants to merge 2 commits from feat/test-audit-log-service into dev
Owner

Fixes core/php-mcp#5

Summary

  • Add Pest unit tests covering all AuditLogService public methods
  • Test record() with all parameter combinations (required, optional, security fields)
  • Test sensitive tool registration, unregistration, and cache clearing
  • Test field redaction (default fields, nested, case-insensitive, tool-specific)
  • Test hash chain integrity and chain verification
  • Test consent requirement checks
  • Test export (JSON, CSV) and retrieval with filters
  • Test statistics gathering (totals, success rates, top tools)

Upstream repo is currently archived — merge into Charon fork, then sync when unarchived.

Test plan

  • All tests pass via ./vendor/bin/pest --filter=AuditLogService
  • Tests follow existing Pest conventions from ToolAnalyticsServiceTest
  • RefreshDatabase trait applied via Pest.php for clean state
Fixes core/php-mcp#5 ## Summary - Add Pest unit tests covering all AuditLogService public methods - Test record() with all parameter combinations (required, optional, security fields) - Test sensitive tool registration, unregistration, and cache clearing - Test field redaction (default fields, nested, case-insensitive, tool-specific) - Test hash chain integrity and chain verification - Test consent requirement checks - Test export (JSON, CSV) and retrieval with filters - Test statistics gathering (totals, success rates, top tools) Upstream repo is currently archived — merge into Charon fork, then sync when unarchived. ## Test plan - [ ] All tests pass via ./vendor/bin/pest --filter=AuditLogService - [ ] Tests follow existing Pest conventions from ToolAnalyticsServiceTest - [ ] RefreshDatabase trait applied via Pest.php for clean state
Charon added 2 commits 2026-03-24 16:13:58 +00:00
Cover all three circuit states (closed, open, half-open), failure
threshold tripping, reset timeout transitions, manual reset, probe
recovery, trial lock contention, success decay, service isolation,
recoverable error detection, and statistics tracking.

Fixes #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cover record(), log entry creation, security audit fields (actor type,
IP, sensitivity), sensitive tool registration, field redaction (default
and tool-specific), hash chain integrity, chain verification, consent
requirements, export/retrieval (JSON, CSV), and statistics.

Fixes #5

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin feat/test-audit-log-service:feat/test-audit-log-service
git checkout feat/test-audit-log-service

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git checkout dev
git merge --no-ff feat/test-audit-log-service
git checkout feat/test-audit-log-service
git rebase dev
git checkout dev
git merge --ff-only feat/test-audit-log-service
git checkout feat/test-audit-log-service
git rebase dev
git checkout dev
git merge --no-ff feat/test-audit-log-service
git checkout dev
git merge --squash feat/test-audit-log-service
git checkout dev
git merge --ff-only feat/test-audit-log-service
git checkout dev
git merge feat/test-audit-log-service
git push origin dev
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Charon/php-mcp#2
No description provided.