Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.
This repository was archived by the owner on May 29, 2026. It is now read-only.

PHPUnit: 95 errors from test/production drift (DownloadService removed, importObjects mock) #1937

@rubenvdlinde

Description

@rubenvdlinde

Summary

The Code Quality workflow's PHPUnit matrix jobs (PHPUnit (PHP 8.3, NC stable32) and PHPUnit (PHP 8.4, NC stable32)) fail on PRs with 95 errors caused by test/production drift — unit tests reference production classes and methods that have since been removed or renamed.

Root cause (two distinct drifts)

  1. OCA\OpenRegister\Service\DownloadService does not exist — multiple Unit\Controller\SchemasControllerTest cases (testCreateReturns500OnException, testRelatedReturns500OnGenericException, testExploreReturns500OnException, and others) call createMock(DownloadService::class), but lib/Service/DownloadService.php no longer exists. PHPUnit throws MockObject\Generator\UnknownTypeException.
  2. importObjects method no longer exists — tests configure a mock method importObjects that is no longer defined on its target class. PHPUnit throws MockObject\MethodCannotBeConfiguredException.

Evidence it is pre-existing (not introduced by a recent quality PR)

  • grep -rn "function importObjects" lib/ → no matches.
  • find lib -name DownloadService.php → no matches.
  • The failing test files were last touched well before the current quality work; the quality-debt PR (fix: clear PHP/Vue quality debt on development (phpcs/eslint/stylelint) #1936) changed zero test files (only package.json/package-lock.json, docs/features.json, and phpcbf whitespace/comment fixes in lib/).

Suggested fix

Update the affected unit tests to the current production surface: drop the DownloadService mock (and its constructor injection) where the class was removed, and replace/remove the importObjects mock expectation with the method that superseded it. Owned by the test-infrastructure track.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions