Skip to content

[ticket/16961] Use virtual filesystem in tests#6982

Open
rubencm wants to merge 10 commits into
phpbb:masterfrom
rubencm:ticket/16961
Open

[ticket/16961] Use virtual filesystem in tests#6982
rubencm wants to merge 10 commits into
phpbb:masterfrom
rubencm:ticket/16961

Conversation

@rubencm

@rubencm rubencm commented Jul 12, 2026

Copy link
Copy Markdown
Member

PHPBB-16961

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-12345

@private-packagist

Copy link
Copy Markdown

phpBB/composer.lock

Dev Package changes

Package Operation From To About
mikey179/vfsstream add - v1.6.12 view code - License: BSD 3-Clause "New" or "Revised" License

Settings · Docs · Powered by Private Packagist

@rubencm
rubencm marked this pull request as draft July 12, 2026 01:49
@rubencm rubencm changed the title [ticket/16961] Use local filesystem for storage tests [ticket/16961] Use virtual filesystem in tests Jul 12, 2026
@rubencm
rubencm force-pushed the ticket/16961 branch 2 times, most recently from 2a6d356 to 06af0ef Compare July 12, 2026 09:44
@rubencm
rubencm requested a review from Copilot July 12, 2026 10:26
@rubencm
rubencm marked this pull request as ready for review July 12, 2026 10:27

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 PHPUnit suite to use a virtual filesystem (vfsStream) for file-based fixtures, caches, and temp directories, reducing reliance on the host filesystem and improving test isolation/portability. It also adjusts a couple of production components to better support stream-wrapper paths used by the new tests.

Changes:

  • Add mikey179/vfsstream to dev dependencies and migrate many tests to write into vfs:// instead of tests/**/tmp or repo paths.
  • Update DI/container caching tests to use a configurable cache directory and avoid direct filesystem cleanup.
  • Replace glob() usage in the s9e factory tidy routine and adjust local storage adapter path resolution to better handle stream wrappers.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/upload/fileupload_test.php Switch upload fixtures/copies to vfs paths.
tests/upload/filespec_test.php Replace real FS copy-setup with vfs-backed fixture copies.
tests/update/get_updates_test.php Store download/signature artifacts in vfs tmp and remove manual cleanup.
tests/update/controller_test.php Use vfs root for store/update artifacts and factor file creation helper.
tests/text_formatter/s9e/renderer_test.php Use vfs cache directory for renderer cache.
tests/text_formatter/s9e/factory_test.php Use vfs cache directory and remove manual unlink cleanup.
tests/test_framework/phpbb_test_case_helpers.php Create/use vfs-backed s9e cache directory for formatter services.
tests/storage/adapter/local_test.php Rely on vfs-backed local adapter test case cleanup instead of unlink.
tests/storage/adapter/local_test_case.php Configure local storage adapter against vfs root path.
tests/mock/phpbb_di_container_builder.php Allow container/autoload cache files to be written to an injected cache dir.
tests/mimetype/guesser_test.php Use vfs fixtures for jpg paths while keeping binary guesser fixtures on real FS.
tests/messenger/queue_test.php Move queue cache file into vfs tmp.
tests/lock/posting_test.php Use vfs tmp directory for file cache driver.
tests/lock/flock_test.php Use vfs for non-fork lock tests; keep real FS path for forked-process test.
tests/di/fixtures/manager_mock.php Extract extension manager mock into a fixture file.
tests/di/create_container_test.php Use vfs cache dir for dumped container output.
tests/di/container_cache_directory_test.php Use vfs cache dirs and scandir-based assertions for cached artifacts.
tests/console/thumbnail_test.php Use vfs for storage and temp paths; update storage mock callbacks accordingly.
tests/console/cache/purge_test.php Use vfs cache dir and remove manual directory management helpers.
tests/cache/file_driver_test.php Use vfs cache dir and remove manual cleanup helpers.
phpBB/phpbb/textformatter/s9e/factory.php Replace glob() with scandir() for cache cleanup to work with vfs.
phpBB/phpbb/storage/adapter/local.php Adjust root path resolution to better handle wrappers where realpath() fails.
phpBB/composer.lock Lockfile update including vfsStream package.
phpBB/composer.json Add mikey179/vfsstream to dev requirements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread phpBB/phpbb/storage/adapter/local.php Outdated
Comment thread phpBB/phpbb/textformatter/s9e/factory.php
Comment thread tests/mock/phpbb_di_container_builder.php
Comment thread tests/mock/phpbb_di_container_builder.php
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