Skip to content

test(setup): Improve db detection and web-root resolution coverage - #62773

Draft
joshtrichards wants to merge 4 commits into
masterfrom
jtr/test-Setup-fix-and-expand-coverage
Draft

test(setup): Improve db detection and web-root resolution coverage#62773
joshtrichards wants to merge 4 commits into
masterfrom
jtr/test-Setup-fix-and-expand-coverage

Conversation

@joshtrichards

Copy link
Copy Markdown
Member
  • Resolves: #

Summary

Improve SetupTest coverage for database detection and web-root resolution.

  • Assert the expected PDO-driver lookups and oci_connect availability check.
  • Cover getSupportedDatabases(true) (allowAllDatabases) without reading configuration.
  • Cover ignoring unknown configured database names.
  • Cover non-CLI findWebRoot() behavior, including the / fallback.
  • Restore global \OC::$CLI and \OC::$WEBROOT state safely in the web-root tests.
  • Route the PDO availability check through the existing mockable class_exists() wrapper, making the unavailable-PDO path unit-testable.

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Josh <josh.t.richards@gmail.com>
- `getSupportedDatabases(true)` bypasses system configuration and evaluates all known DB types.
- unknown configured values are silently ignored, while later valid values are retained.
- PDO versus function availability probes are dispatched the expected number of times and with the expected callable.
- non-CLI `findWebRoot()` must not access `overwrite.cli.url`; it returns `\OC::$WEBROOT`, defaulting to '/' and also handling sub-directory installs.

Signed-off-by: Josh <josh.t.richards@gmail.com>
The existing test fixture mocks `getAvailableDbDriversForPdo()` itself. This adds a separate partial mock that mocks only `class_exists()`, which is testable after fixing Setup to use the $this->class_exists() wrapper it already has in it...

Signed-off-by: Josh <josh.t.richards@gmail.com>
The wrapper was already there; just wasn't being used.

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 2. developing Work in progress feature: install and update tests Related to tests feature: database Database related DB ⚠️ risk: low Unlikely to cause meaningful regressions; limited runtime or compatibility impact. labels Aug 2, 2026
@joshtrichards joshtrichards changed the title test: expand Setup database coverage test(setup): Improve db detection and web-root resolution coverage Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress feature: database Database related DB feature: install and update ⚠️ risk: low Unlikely to cause meaningful regressions; limited runtime or compatibility impact. tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant