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

[8/8] fix(tests): stabilise 11 PHPUnit failures + ProductionVersionGuardListener runtime bug#65

Merged
rubenvdlinde merged 2 commits into
developmentfrom
fix/openbuilt-phpunit-stabilisation
May 16, 2026
Merged

[8/8] fix(tests): stabilise 11 PHPUnit failures + ProductionVersionGuardListener runtime bug#65
rubenvdlinde merged 2 commits into
developmentfrom
fix/openbuilt-phpunit-stabilisation

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Summary

Top of the stack. Two unrelated fixes that surfaced after the chain was implemented:

PHPUnit stabilisation (11 failures → 0)

Spec agents ran `composer check:strict` but that doesn't include PHPUnit in this repo; some tests were broken by the chain's stub additions / setUp refactors and shipped red. This PR fixes them all:

  • CreateFromTemplateTest (6 errors) — pre-existing templates-marketplace tests; updated to match current controller surface.
  • ApplicationCreationService + Controller tests (3 failures) — spec F's tests needed setUp refactor (PHPUnit 10 disallows re-stubbing a once-stubbed mock method); introduced `authenticateAsAdmin()` helper.
  • ManifestResolverServiceTest (3 failures) — spec E test fixtures lacked `uuid` on the application + `application` relation on the version; `findVersionBySlug` short-circuits when these are missing.

ProductionVersionGuardListener runtime fix (CRITICAL)

Spec C's listener called `$event->getObject()` on both `ObjectCreatingEvent` AND `ObjectUpdatingEvent` — but the real OR API only exposes `getObject()` on Creating; Updating uses `getNewObject()`. This crashed every OR object update across the entire Nextcloud instance (pipelinq seeding tripped first during `occ maintenance:repair`).

Fix: branch on event type and call the correct method; stub class updated to match the real constructor signature (`newObject, ?oldObject`).

Test plan

  • PHPUnit — 180/180 pass (was 169/180)
  • composer check:strict — ALL CHECKS PASSED
  • Vitest — 487/487
  • All 14 hydra gates — green
  • `docker exec nextcloud php occ maintenance:repair` completes cleanly post-fix

Bugs surfaced during visual smoke (filed separately)

  • VirtualAppsActions actionsComponent not mounting on CnIndexPage's index pages
  • OR data fetch produces `[object Object]` in URL paths from openbuilt's store
  • Icon endpoint `/apps/openbuilt/icons/{slug}.svg` returns 404
  • Green-field migration didn't drop Hello World on this install (idempotency check may be too eager)

These are all integration glitches at the edges of the chain — none invalidate the chain's design. See morning report file for details.

🤖 Generated with Claude Code

…reateFromTemplate

CreateFromTemplateTest (6 errors): pre-existing test from templates-marketplace; updated to match current controller surface.

ApplicationCreationServiceTest + ApplicationCreationControllerTest (1 error + 2 failures): spec F tests needed setUp refactor (PHPUnit 10 disallows re-stubbing once-stubbed mock methods); introduced an authenticateAsAdmin() helper that each authenticated test calls explicitly.

ManifestResolverServiceTest (3 failures): spec E test fixtures lacked uuid on the application object and 'application' relation on the version object; findVersionBySlug short-circuits when these are missing. Fixed fixtures.

PHPUnit: 180/180 pass (was 169/180). composer check:strict, npm run lint, vitest 487/487, hydra 14/14 all green.
ProductionVersionGuardListener crashed on every OR ObjectUpdatingEvent
(pipelinq seeding tripped over it during 'occ maintenance:repair' with
'Call to undefined method ObjectUpdatingEvent::getObject()').

Real OR signatures (verified against openregister/lib/Event/):
- ObjectCreatingEvent::getObject(): ObjectEntity
- ObjectUpdatingEvent::getNewObject(): ObjectEntity

Spec C's listener and its stub both used getObject() for both — fixed
to branch on event type and updated the stub class to match the real OR
constructor signature (newObject + optional oldObject).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant