Skip to content

fix(tests): load the ObjectCreatedEvent stub after Nextcloud boots - #1213

Merged
rubenvdlinde merged 2 commits into
developmentfrom
fix/phpunit-bootstrap-loads-ocp
Oct 2, 2026
Merged

rubenvdlinde merged 2 commits into
developmentfrom
fix/phpunit-bootstrap-loads-ocp

Conversation

@rubenvdlinde

Copy link
Copy Markdown
Contributor

Every PHPUnit leg in Code Quality on development died in tests/bootstrap.php:62 with Class "OCP\EventDispatcher\Event" not found before any test ran.

Cause. tests/Stubs/Event/ObjectCreatedEvent.php (added in #1197) extends OCP\EventDispatcher\Event. The early tests/Stubs/{,**/}*.php glob reaches one level deep, so it required the stub before lib/base.php had run. nextcloud/ocp ships no autoload section, so nothing could resolve OCP at that point.

Fix. The stub moves to tests/Stubs/OpenRegister/Event/, out of the glob's reach. It loads after the Nextcloud boot, and only when OCP resolves and the real OpenRegister event does not. This is the same pattern the Integriq event stubs already use. tests/bootstrap-unit.php points its PSR-4 map at the new path.

Verified locally.

  • phpunit -c phpunit.xml before the fix reproduces the CI bootstrap error. After the fix the bootstrap passes. On the host it then stops at test loading, because there is no Nextcloud tree and no OCP.
  • phpunit -c phpunit-unit.xml gives the same result before and after: 1071 tests, 20 errors, 1 failure. These are the known host-only gaps.

The PHPUnit legs in CI are the real proof. Any test that now runs and fails is inherited debt and is listed in the follow-up.

🤖 Generated with Claude Code

The stub extends OCP\EventDispatcher\Event and sat one level under
tests/Stubs, so the early stub glob in tests/bootstrap.php required it
before lib/base.php made OCP resolvable. Every CI PHPUnit leg died in the
bootstrap with Class "OCP\EventDispatcher\Event" not found before any
test ran. Move it two levels deep, out of the glob's reach, and load it
after the boot when OCP resolves and the real OpenRegister event does not.
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/stackiq @ fabcc28

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
check-vue-demi ✅
test-l10n ✅
format ✅
check-schema-l10n ✅
check-l10n-js ✅
composer ✅ ✅ 130/130
npm ✅ ✅ 807/807
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ❌
Newman ⏭️
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-10-02 04:20 UTC

Download the full PDF report from the workflow artifacts.

… publication field rules

With the bootstrap fixed, CI ran stackiq's unit tests for the first time in a
while and found two merged PRs disagreeing: #1209's test said usage may have no
public read rule, while #1206 gives usage a public rule conditional on
publicationDate. Owners stay private either way: contactPerson has no public
rule, the import never sets a usage's publicationDate, and usage.businessOwner,
technicalOwner and contactPerson carry authenticated-only property rules. The
test now pins exactly that, and fails if any of those person properties is made
public (control run: businessOwner set to public fails it).
@rubenvdlinde
rubenvdlinde merged commit ae22b32 into development Oct 2, 2026
7 checks passed
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Quality Report — ConductionNL/stackiq @ 371a824

Check PHP Vue Security License Tests
lint ✅
phpcs ✅
phpmd ✅
psalm ✅
phpstan ✅
phpmetrics ✅
eslint ✅
stylelint ✅
build ✅
check-manifest ✅
check-vue-demi ✅
test-l10n ✅
format ✅
check-schema-l10n ✅
check-l10n-js ✅
composer ✅ ✅ 130/130
npm ✅ ✅ 807/807
app:check-code ⏭️
info.xml ✅
REUSE ❌
lockfile sync ✅
PHPUnit ❌
Newman ⏭️
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-10-02 04:37 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.

1 participant