Skip to content

feat(tests): add --parallel support for PHPUnit execution (#8)#29

Draft
coisa wants to merge 7 commits intomainfrom
feature/8-parallel-tests
Draft

feat(tests): add --parallel support for PHPUnit execution (#8)#29
coisa wants to merge 7 commits intomainfrom
feature/8-parallel-tests

Conversation

@coisa
Copy link
Copy Markdown
Contributor

@coisa coisa commented Apr 11, 2026

Summary

  • Adds --parallel option to dev-tools tests command for parallel test execution
  • Uses ParaTest as the parallel runner under the hood
  • Supports both --parallel for auto-detected worker count and --parallel=N for explicit worker count

Breaking Change Notice

This feature requires the project to be run on PHP 8.3 or PHP 8.4. When running on PHP 8.5+, the --parallel option will automatically fall back to serial PHPUnit execution with a warning message.

PHP 8.5+ Compatibility

Warning: Starting with PHP 8.5, the --parallel option is not compatible due to a known bug in PHPUnit/ParaTest that causes crashes with PHP 8.5's stricter readonly class enforcement. When detected, the command automatically falls back to serial PHPUnit execution.

Changes

Change Description
TestsCommand.php Added --parallel option with PHP 8.5+ detection and fallback
composer.json Added brianium/paratest as dev dependency

Usage

# Run tests with default parallel workers (PHP 8.3/8.4 only)
dev-tools tests --parallel

# Run tests with 4 workers
dev-tools tests --parallel=4

# On PHP 8.5+: automatically falls back to PHPUnit
dev-tools tests --parallel
# Output: "--parallel is not compatible with PHP 8.5.0. Running tests with PHPUnit instead..."

Behavior

  • --parallel is opt-in (default behavior remains serial)
  • On PHP 8.5+: graceful fallback to PHPUnit with warning
  • Coverage is preserved in parallel mode (PHP 8.3/8.4)
  • Filter options are passed through to ParaTest

Testing

  • All 240 existing tests pass on PHP 8.3/8.4
  • Manual PHP 8.5 fallback testing confirmed

Closes #8

coisa added 6 commits April 10, 2026 23:42
…it execution

Implements: #8

- Add brianium/paratest as dev dependency
- Add --parallel option to tests command
- --parallel uses default worker count, --parallel=N specifies N workers
- Filter PHPUnit arguments to keep only ParaTest-compatible options
- Preserve coverage, filter, and test path options in parallel mode
Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
…stsCommand

Signed-off-by: Felipe Sayão Lobato Abreu <github@mentordosnerds.com>
@coisa coisa marked this pull request as draft April 11, 2026 16:06
@coisa coisa self-assigned this Apr 11, 2026
@coisa
Copy link
Copy Markdown
Contributor Author

coisa commented Apr 11, 2026

We are currently dealing with incompatible dependency versions that prevent ParaTest from functioning correctly.

A concrete symptom of this issue is the following runtime error:

PHP Fatal error: Non-readonly class PHPUnit\Metadata\PostCondition cannot extend readonly class PHPUnit\Metadata\Metadata

This indicates that different or incompatible PHPUnit-related classes are being loaded together, which breaks execution before the test suite can run.

Before we can reliably use ParaTest, we need to resolve these dependency mismatches and bring the full testing stack into a consistent state.

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.

Add --parallel support to tests command for safe, zero-workaround parallel PHPUnit execution

1 participant