Skip to content

test(versioniq): cover the audit and PAT mappers - #670

Merged
rubenvdlinde merged 1 commit into
developmentfrom
quality/test-coverage-d3522ea6-1
Nov 13, 2026
Merged

rubenvdlinde merged 1 commit into
developmentfrom
quality/test-coverage-d3522ea6-1

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Unit tests for lib/Db/.

  • AuditEntryMapperTest (5 tests): newest-first page with limit/offset, app filter only for a non-empty app id, batched oldest-first retention delete by id (PARAM_INT_ARRAY), nothing deleted when nothing is old
  • PatMapperTest (5 tests): findById binds an integer id and throws DoesNotExistException when missing, findAll without filter, findVisibleTo = own OR shared-with-admins newest first, deleteByOwner
  • PatRedactionTest (7 tests): toRedacted() carries every public field and never the encrypted token or warning ledger; scope JSON decoded only when it is an array; empty ledger string

The mappers are exercised through a recording IQueryBuilder double, so the exact table, predicates, ordering, limits and bound parameter types are asserted; rows are mapped by the real QBMapper.

Test support: tests/stubs/server-internals.php (loaded only by the unit-only bootstrap) gains Doctrine\DBAL\Types\Types and Doctrine\DBAL\Query\Expression\ExpressionBuilder constant stubs, next to the existing ParameterType ones. Without them no double of IQueryBuilder / IExpressionBuilder can be created outside a server checkout, which is why the mappers had no unit tests.

Coverage: AuditEntryMapper 0% → 100%, PatMapper 0% → 100%. Each new file was checked to fail when a subject line is broken.

Suite (tests/phpunit-unit-only.xml): before 1356 tests, 2 failures; after 1373 tests, the same 2 failures (inherited golden tests in Service/Installer).

Tests only; no production code changed.


Generated by Claude Code

Adds unit tests for the queries AuditEntryMapper and PatMapper build,
using a recording query builder double, and for Pat::toRedacted().

The unit-only bootstrap stubs gain Doctrine's Types and ExpressionBuilder
constant classes: without them no test double of IQueryBuilder or
IExpressionBuilder can be created outside a server checkout.

Assisted-by: ClaudeCode:claude-opus-5-5
@rubenvdlinde
rubenvdlinde merged commit 7c18074 into development Nov 13, 2026
7 of 9 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/versioniq @ 8af9614

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
composer ✅ ✅ 32/32
npm ✅ ✅ 302/302
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ❌ 1338/1348 · 25 skipped (worst of 8 legs: PHP 8.3, NC stable32, pgsql)
Newman ⏭️
Playwright ⏭️ deferred: E2E runs locally and on the promotion path only. This pull request targets development, so the suite is asked once per promotion into beta and main rather than once per push per open pull request. Run it locally with npx playwright test, or from the Actions tab on a branch with no open pull request into development.
Hydra gates ✅

Quality workflow — 2026-11-15 05:43 UTC

Download the full PDF report from the workflow artifacts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant