Skip to content

[access] test(command): cover eight occ commands to 100% statements - #7519

Merged
rubenvdlinde merged 3 commits into
mainfrom
cloud/t04-commands
Nov 9, 2026
Merged

rubenvdlinde merged 3 commits into
mainfrom
cloud/t04-commands

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

SIG coverage round t1, lane T04: PHP unit tests for console commands.

Covered

New test files only, with no production changes. None of them carries @covers or #[CoversClass]. phpunit.xml sets beStrictAboutCoverageMetadata=true, and that setting is why several existing tests for these classes record 0 coverage: they execute classes that are not in their @uses list, so PHPUnit marks them risky and discards their coverage.

File Before (CI clover, development 30fbb6d) After (subset run)
lib/Command/RelinkRegisterSchemasCommand.php 0/65 65/65
lib/Command/SchemaColumnDriftPass.php (Support/) 20/71 71/71
lib/Command/DeclaredGroupsCommand.php 0/44 44/44
lib/Command/ImportSkosCsvCommand.php 0/37 37/37
lib/Command/DraftsExpiredCommand.php 0/33 33/33
lib/Command/ExampleSetRemoveCommand.php 0/26 26/26
lib/Command/ResolverListCommand.php 0/21 21/21
lib/Command/ExampleSetListCommand.php 0/13 13/13
Total 20/310 310/310

The tests drive each command through CommandTester and assert the exit code, the exact output and the exact service calls and arguments. Only the injected interfaces are mocked. Every early return, refusal and catch has its own test.

Ran

  • php -d pcov.enabled=1 -d pcov.directory=lib vendor/bin/phpunit -c phpunit.xml --coverage-clover /tmp/cmd.xml --filter '<the 8 new test classes>' tests/Unit/Command: OK (50 tests, 175 assertions), 0 risky.
  • clover_files.py on the result gives 310/310. This is a subset run, so it is a lower bound on the full-suite number.
  • weak.php over tests/Unit/Command reports none of the new files.

Mutation samples (each reverted)

  • mutation: lib/Command/RelinkRegisterSchemasCommand.php:115 $write === false -> === true -> 2 tests failed
  • mutation: lib/Command/RelinkRegisterSchemasCommand.php:171 $rowCount < 0 -> < -1 -> 1 test failed
  • mutation: lib/Command/ResolverListCommand.php:93 $map === [] -> !== [] -> 2 tests failed
  • mutation: lib/Command/DeclaredGroupsCommand.php:153 members === 0 -> === -1 -> 2 tests failed
  • mutation: lib/Command/DeclaredGroupsCommand.php:122 dropped || $report['empty'] > 0 -> 1 test failed
  • mutation: lib/Command/ExampleSetListCommand.php:90 isEmpty(...) === true -> === false -> 1 test failed
  • mutation: lib/Command/ExampleSetRemoveCommand.php:130 return true -> return false in isNote -> 1 test failed
  • mutation: lib/Command/ImportSkosCsvCommand.php:113 !== -> === in the option filter -> 3 tests failed
  • mutation: lib/Command/ImportSkosCsvCommand.php:120 catch InvalidArgumentException -> catch \DomainException -> 1 test failed
  • mutation: lib/Command/DraftsExpiredCommand.php:126 dropped the min(..., MAX_REMOVALS) cap -> 1 test failed
  • mutation: lib/Command/Support/SchemaColumnDriftPass.php:184 dropped the metadata-column filter -> 2 tests failed

The tests were written with Claude Code.


Generated by Claude Code

…s import commands

Assisted-by: ClaudeCode:claude-opus-5-5
…ft pass

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

Copy link
Copy Markdown
Contributor Author

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

It fails in the step "PHPUnit unit suite (in-container, HARD GATE)". The same 11 errors, 11 failures and 1 warning show up on unrelated PRs that day, including the JS-only #7510 (run 42568091384). Those failures are in ProcessingLogServiceGoldenTest, where the actual keys now include channel, and in SearchReferenceResolverGoldenTest (var_export on a circular reference), plus 9 others.

Tests Errors Failures Warnings
#7510 49064 11 11 1
this PR 49114 11 11 1

The 50 extra tests are exactly this PR's 50 new tests, and all of them pass. Locally, ProcessingLogServiceGoldenTest also passes on development without a booted Nextcloud, so the failure seems to need the in-container runtime. I have no fix for it yet. It belongs in its own fix, not in this test-only PR.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / Frontend Check (test:l10n:parity) check isn't caused by this PR. This PR only adds files under tests/Unit/Command/ and touches no l10n/ or src/ file.

The same failure happens on plain development at 70e5570. Running node tests/l10n/check-l10n-parity.js there gives:

l10n-parity: FAIL — a locale lost parity, or a value would render blank:
  • frontend (.js) de: 1 missing key(s) … missing: "We could not count the objects. Close this window and try again."
  • frontend (.js) fr / es / it / …: same key missing

A recently merged change added that English string to en.js without translating it into the other locales. The fix belongs in its own l10n commit, following the §6.15 procedure in docs/l10n-workflow.md, not in this test-only PR. No such fix exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / Vue Quality (eslint) check doesn't come from this PR. This PR adds only PHP test files, and eslint does not lint PHP.

The run reports 16 errors, all in files outside this PR. For example, tests/Unit/Controller/fixtures/notification-history-controller-golden.json trips json/no-unsafe-values on 9223372036854775807 at lines 521 and 528. That fixture and the other flagged files come from development.

The fix belongs in its own PR. None exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / Frontend Check (test:l10n) and quality / Frontend Check (format) checks are not caused by this PR either.

This PR only adds PHP test files under tests/Unit/Command/.

  • test:l10n checks that en.js covers every t()/n() call in src/. The repo's CLAUDE.md already records it as red at HEAD: keys used in src/ are missing from en.js after a development merge.
  • format runs prettier over the frontend sources, and this PR adds no file it checks.

Both need their own fixes on development. Neither exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / PHP Quality (phpstan) check is not caused by this PR. phpstan only analyses lib/: paths: - %currentWorkingDirectory%/lib in vendor/conduction/hydra-gates/quality-config/phpstan-base.neon. This PR adds only files under tests/Unit/Command/ and changes nothing in lib/, so the findings come from development. That fix belongs in its own PR, and none exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / PHP Quality (psalm) check doesn't come from this PR either. psalm.xml analyses only <directory name="lib" /> plus a few named stubs, and this PR changes nothing in lib/ (it only adds files under tests/Unit/Command/). So the findings come from development. That fix belongs in its own PR, and none exists yet.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / Hydra Gates check is not caused by this PR either. The 7 failing gates all inspect production code under lib/, src/ and appinfo/, and this PR changes none of those:

  • 3 stub-scan (lib/Service, lib/Controller)
  • 7 no-admin-idor
  • 12 nc-input-labels
  • 17 redundant-controller
  • 40 form-label-association
  • 46 spec-anchor-existence
  • 49 controller-exception-translation

The findings are standing debt on development (for example, 113 NoAdminRequired methods for gate 7). Fixing them belongs in its own PR.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

This PR does not cause the red quality / PHP Quality (phpcs), quality / PHP Quality (phpmd) or quality / Frontend Tests (unit) checks. This PR only adds files under tests/Unit/Command/.

  • phpcs: phpcs.xml checks only <file>lib</file>.
  • phpmd: the composer phpmd script runs only phpmd lib.
  • Frontend Tests (unit): jest runs the same frontend code as on development, because this PR changes no JS, Vue or jest config.

All three failures come from development and need their own fixes there.


Generated by Claude Code

Copy link
Copy Markdown
Contributor Author

The red quality / Integration Tests (Newman) check is not caused by this PR either. That job runs the Postman collections against a booted app built from lib/, appinfo/ and the migrations. This PR changes none of those; it only adds PHPUnit files under tests/Unit/. So the app under test is the same as on development.

The job log shows production-side errors. One example is value "1794215603466823" is out of range for type integer on an insert into oc_openregister_table_22_100, where a *_us microsecond column is typed integer. Another is a missing magic table, oc_openregister_table_20_27. Both come from development, and fixing them belongs in its own PR.


Generated by Claude Code

@rubenvdlinde
rubenvdlinde merged commit a219c97 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 @ c85e3d4

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 ❌ 49085/49095 · 19 skipped
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 13:05 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