Repository navigation
Add run-unit-tests.sh: an extension's PHPUnit tests as CI runs them - #19
Merged
Merged
Conversation
Sets up a phpBB checkout on first use (shallow clone, Composer dependencies, and on PHP 8 with 3.3.x the PHPUnit 9 switch phpBB's own CI makes), copies the extension in afresh every run with rsync --delete, and runs its phpunit.xml.dist with phpBB's PHPUnit and bootstrap. Options for the phpBB branch, the checkout, updating, a filter and extra PHPUnit arguments. Option-handling tests and shellcheck in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Running an extension's unit tests locally needs a phpBB checkout with phpBB's own PHPUnit and test bootstrap, as phpbb-extensions/test-framework sets up in CI.
phpbb-test-board/run-unit-tests.shdoes that in one command.~/.cache/phpbb-release-tools/phpbb-BRANCH(or--env DIR/PHPBB_UNIT_ENV). That's a shallow clone, Composer dependencies, and on PHP 8 with phpBB 3.3.x the switch to PHPUnit 9 that phpBB's own.github/setup-phpbb.shmakes, since 3.3.x ships PHPUnit 7.5, which doesn't run on PHP 8.1 or later.rsync --delete, without.git) under itscomposer.jsonname, then runs itsphpunit.xml.dist. No test runs against an old copy.-b 3.3.x|master,-e DIR,-uto update the checkout,-f PATTERN, and--to pass more arguments to PHPUnit. No arguments prints help. The exit status is PHPUnit's, 1 for a setup failure and 2 for bad arguments.tests/test-phpbb-test-board.sh, which clone and run nothing. The script is added to the shellcheck step in CI, and the test-board README documents it.Claude ran it against phpbbmodders/phpbb-ext-wiki: 274 tests pass on phpBB 3.3.x (PHPUnit 9.6, PHP 8.4), including a first run that set up its own checkout. On master, 274 pass with 3 skipped, which are the wiki's own migration test skipping its schema checks on 4.0. It was written after a hand-made stand-in for PHPUnit missed a broken test that CI then caught.
Investigated and written by Claude on behalf of William Jacoby (bonelifer).
🤖 Generated with Claude Code