Skip to content

[ticket/17683] Avoid using phpbb filesystem during some tests#6983

Draft
rubencm wants to merge 4 commits into
phpbb:masterfrom
rubencm:ticket/17683
Draft

[ticket/17683] Avoid using phpbb filesystem during some tests#6983
rubencm wants to merge 4 commits into
phpbb:masterfrom
rubencm:ticket/17683

Conversation

@rubencm

@rubencm rubencm commented Jul 15, 2026

Copy link
Copy Markdown
Member

Checklist:

  • Correct branch: master for new features; 3.3.x for fixes
  • Tests pass
  • Code follows coding guidelines: master and 3.3.x
  • Commit follows commit message format

Tracker ticket:

https://tracker.phpbb.com/browse/PHPBB-17683

@rubencm
rubencm marked this pull request as draft July 15, 2026 21:06
@rubencm
rubencm marked this pull request as ready for review July 19, 2026 09:43
@rubencm rubencm changed the title [ticket/17683] Avoid file permission errors during tests [ticket/17683] Avoid some file permission errors during tests Jul 19, 2026
@rubencm rubencm changed the title [ticket/17683] Avoid some file permission errors during tests [ticket/17683] Avoid using phpbb filesystem during some tests Jul 19, 2026
@rubencm
rubencm requested a review from Copilot July 19, 2026 17:29
@rubencm
rubencm marked this pull request as draft July 19, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_case and 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 thread tests/lock/flock_test.php
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);
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.

2 participants