Skip to content

Add run-unit-tests.sh: an extension's PHPUnit tests as CI runs them - #19

Merged
bonelifer merged 1 commit into
mainfrom
run-unit-tests
Oct 14, 2026
Merged

bonelifer merged 1 commit into
mainfrom
run-unit-tests

Conversation

@bonelifer

Copy link
Copy Markdown
Contributor

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.sh does that in one command.

  • On first use it sets up a phpBB checkout in ~/.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.sh makes, since 3.3.x ships PHPUnit 7.5, which doesn't run on PHP 8.1 or later.
  • Every run copies the extension in afresh (rsync --delete, without .git) under its composer.json name, then runs its phpunit.xml.dist. No test runs against an old copy.
  • Options: -b 3.3.x|master, -e DIR, -u to 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.
  • 8 option-handling tests in 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

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>
@bonelifer
bonelifer merged commit 8c2e3b9 into main Oct 14, 2026
1 check passed
@bonelifer
bonelifer deleted the run-unit-tests branch October 14, 2026 17:38
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.

1 participant