Skip to content

phpunit-unit.xml is red out of the box: 91 errors, all the capability stubs refusing to answer #851

Description

@rubenvdlinde

What was measured

phpunit -c phpunit-unit.xml --do-not-fail-on-warning --no-coverage on a clean
checkout of development:

Tests: 1914, Assertions: 5856, Errors: 91, Failures: 3, Warnings: 1

exit 2. Identical on both sides of a git stash, so this is not something a
branch introduced. Found during the cleanup in #841, which does not touch it.

phpunit.xml, the config CI runs, is fine: OK (1914 tests, 6122 assertions),
exit 0.

What the errors are

All 91 are the deliberate refusals in the capability stubs, in two classes:

LogicException: OCA\OpenRegister\Service\Capability\ToolGrantResolver was resolved from
hermiq's ANALYSIS STUB rather than from OpenRegister. The real class ships with
OpenRegister (ADR-099 §5); tests/bootstrap.php maps it from
../openregister/lib/Service/Capability. Refusing rather than answering, because a
stubbed grant grammar would make every authorization test pass against a fake.

and the same shape for ToolGrantSet.

The refusal itself is right, and worth keeping: a stubbed grant grammar would
make every authorization test pass against a fake, which is the failure mode
this codebase keeps hitting. The problem is that tests/bootstrap-unit.php never
maps the capability roots at all, so on that config the refusal is unavoidable
rather than diagnostic.

Why it is worth fixing rather than living with

phpunit-unit.xml is the config a developer reaches for locally, because it
runs without a Nextcloud tree. It being red by construction means a real
regression on it is indistinguishable from the standing 91, so nobody reads it,
so it is not a check.

Two shapes that would both work, in preference order:

  1. Map the capability roots in tests/bootstrap-unit.php too, the way
    tests/bootstrap.php does, and let the refusal fire only when openregister
    really is absent.
  2. Have that config skip the capability suites explicitly, so it reports a
    smaller green rather than a large red. Weaker, because a skip that nobody
    revisits is its own kind of hollow green, but honest.

Do not fix it by softening the LogicException into a warning. Refusing is the
point.

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

Labels

triageAwaiting triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions