[ticket/17683] Avoid using phpbb filesystem during some tests#6983
Draft
rubencm wants to merge 4 commits into
Draft
[ticket/17683] Avoid using phpbb filesystem during some tests#6983rubencm wants to merge 4 commits into
rubencm wants to merge 4 commits into
Conversation
rubencm
marked this pull request as draft
July 15, 2026 21:06
PHPBB-17683
rubencm
marked this pull request as ready for review
July 19, 2026 09:43
rubencm
marked this pull request as draft
July 19, 2026 17:30
There was a problem hiding this comment.
Pull request overview
This PR updates phpBB’s test infrastructure to avoid relying on the local filesystem for certain test scenarios (per PHPBB-17683), primarily by introducing a database-backed storage provider for functional tests and reducing filesystem writes during database test setup.
Changes:
- Switch functional tests’ attachment/avatar/backup storage providers to a new DB-backed adapter/provider.
- Refactor functional ACP storage settings tests to explicitly toggle providers for local-path validation and restore DB storage afterward.
- Remove schema-file generation/copying side effects from
phpbb_database_test_caseand make concurrent flock tests use a real temporary file (not vfsStream).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_framework/phpbb_functional_test_case.php | Sets functional test storage providers to the new DB-backed provider after installation. |
| tests/test_framework/phpbb_database_test_case.php | Removes schema file generation/copy/unlink side effects from DB test setup/teardown. |
| tests/lock/flock_test.php | Uses tempnam() in system temp dir for forked flock testing and improves fork handling. |
| tests/functional/storage/db_provider.php | Adds a test-only storage provider that points to the DB-backed adapter. |
| tests/functional/storage/db_adapter.php | Adds a test-only adapter that stores file contents in config_text (DB) across requests/processes. |
| tests/functional/acp_storage_settings_test.php | Splits/extends tests to cover “no changes” and local-provider path warnings, with provider switching helpers. |
| phpBB/config/test/container/services.yml | Registers the new DB storage adapter/provider services in the test container. |
| phpBB/composer.json | Adds autoload-dev PSR-4 mapping so test storage classes are autoloadable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+63
to
+67
| if (fwrite($stream, $content) === false) | ||
| { | ||
| fclose($stream); | ||
| throw new storage_exception('STORAGE_CANNOT_OPEN_FILE', $path); | ||
| } |
Comment on lines
+77
to
+82
| $path = tempnam(sys_get_temp_dir(), 'phpbb_flock_'); | ||
| if ($path === false) | ||
| { | ||
| $this->markTestSkipped('Unable to create temporary lock file'); | ||
| } | ||
| unlink($path); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist:
Tracker ticket:
https://tracker.phpbb.com/browse/PHPBB-17683