Skip to content

[access] test(apphost): cover the generic AppHost controllers and deep-link listener - #7538

Merged
rubenvdlinde merged 1 commit into
mainfrom
cloud/t04-controllers
Nov 9, 2026
Merged

rubenvdlinde merged 1 commit into
mainfrom
cloud/t04-controllers

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

SIG coverage round t1, lane T04: PHP unit tests for the generic AppHost controllers. The settings and preferences controllers enforce admin checks, which is why this carries the [access] prefix.

Covered

This PR adds new test files only and changes no production code. The new tests carry no coverage metadata, because phpunit.xml sets beStrictAboutCoverageMetadata=true.

File Before (CI clover, development 30fbb6d) After (subset run)
lib/AppHost/Controller/GenericHealthController.php 1/17 17/17
lib/AppHost/Controller/GenericDashboardController.php 1/14 14/14
lib/AppHost/Controller/GenericSettingsController.php 6/17 17/17
lib/AppHost/Controller/GenericMetricsController.php 1/7 7/7
lib/AppHost/Controller/GenericSettingsControllerBase.php 13/17 17/17
lib/AppHost/Controller/GenericPreferencesController.php 38/39 39/39
lib/AppHost/Listener/GenericDeepLinkRegistrationListener.php 36/44 43/44
Total 96/155 154/155 (99.4%)

The tests check the admin refusals (isAdmin === false), the CORS branch, and the setPreference refusal of a bad key with 400. They also cover the index/update catch blocks and the deep-link guards for an empty schema slug, a missing manifest and invalid JSON.

Left uncovered: in GenericDeepLinkRegistrationListener::loadDeepLinks(), the return []; that runs when file_get_contents returns false after is_readable has passed. A test cannot reach it without a production seam (an injectable reader).

Ran

  • php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/ctl.xml --filter '<the 7 new classes + existing GenericSettingsControllerBaseTest, GenericPreferencesControllerTest>' tests/Unit/AppHost: OK (48 tests, 121 assertions), 0 risky. This is a subset run, so the figures above are a lower bound.
  • weak.php over tests/Unit/AppHost reports none of the new files.

Mutation samples (each reverted)

  • mutation: lib/AppHost/Controller/GenericHealthController.php:100 cors === true -> !== true -> 2 tests failed
  • mutation: lib/AppHost/Controller/GenericDashboardController.php:143 answer !== null -> === null -> 2 tests failed
  • mutation: lib/AppHost/Controller/GenericSettingsController.php:81 isAdmin === false -> === true -> 1 test failed
  • mutation: lib/AppHost/Controller/GenericMetricsController.php:89 Content-Type value changed -> 1 test failed
  • mutation: lib/AppHost/Controller/GenericSettingsControllerBase.php:123 isAdmin === false -> === true -> 1 test failed
  • mutation: lib/AppHost/Controller/GenericPreferencesController.php:137 safeKey === '' -> === 'zz' -> 1 test failed
  • mutation: lib/AppHost/Listener/GenericDeepLinkRegistrationListener.php:90 dropped the schemaSlug === '' guard -> 1 test failed

The tests were written with Claude Code.


Generated by Claude Code

… and preferences controllers and the deep-link listener

Assisted-by: ClaudeCode:claude-opus-5-5

Copy link
Copy Markdown
Contributor Author

The red Newman API Test Suite check was not caused by this PR.

It fails in the "PHPUnit unit suite (in-container, HARD GATE)" step. That step currently fails on every PR, including the JS-only #7510:

Run Tests Errors Failures Warnings
#7510 (JS-only, baseline) 49064 11 11 1
this PR 49095 11 11 1

The 31 extra tests are exactly this PR's 31 new tests, and they all pass. The failing tests are ProcessingLogServiceGoldenTest, SearchReferenceResolverGoldenTest and others, none of which this PR touches. No fix exists yet; it belongs in its own PR. #7519 has the details.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

This PR only adds PHP test files, so these quality / … checks are red for reasons that have nothing to do with it:

  • test:l10n and test:l10n:parity are red on plain development: a key is missing from the locales, and src keys are missing from en.js.
  • The eslint errors are in files from development. format checks frontend files, which this PR doesn't touch.
  • phpstan and psalm only analyse lib/, which this PR does not touch.

The evidence is in #7519. Each check needs its own fix on development. None exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

This adds to my earlier comment and covers three more checks this PR does not cause:

  • phpcs checks only lib (phpcs.xml).
  • phpmd checks only lib (the composer phpmd script).
  • Hydra Gates inspects lib/, src/ and appinfo/. Its 7 failing gates are standing debt on development.

This PR changes only tests/. The details are in #7519 and #7523.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

This PR does not cause any red quality / Frontend Tests (unit) (jest) result. It adds only PHPUnit files under tests/Unit/ and does not touch src/, any .js/.vue file or the jest config. Jest therefore runs the same code as on development, where it fails the same way (#7554 shows it too).


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit d6b093c into main Nov 9, 2026
37 of 49 checks passed
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/openregister @ 06eeb6c

Check PHP Vue Security License Tests
lint ✅
phpcs ❌
phpmd ❌
psalm ❌
phpstan ❌
phpmetrics ✅
eslint ❌
stylelint ✅
build ✅
check-specs ✅
test-l10n ❌
test-l10n-parity ❌
format ❌
check-schema-l10n ✅
test-coverage-ratchet ✅
composer ✅ ✅ 168/168
npm ✅ ✅ 641/641
app:check-code ⏭️
info.xml ✅
REUSE ✅
lockfile sync ✅
PHPUnit ❌ cancelled — no verdict
Newman ❌ 1625/1628
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-09 15:19 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.

2 participants