Skip to content

Migrate CI to GitHub Actions and upgrade PHPUnit for PHP 8 compatibility#33

Merged
sirbrillig merged 3 commits into
masterfrom
migrate-to-github-actions
Apr 26, 2026
Merged

Migrate CI to GitHub Actions and upgrade PHPUnit for PHP 8 compatibility#33
sirbrillig merged 3 commits into
masterfrom
migrate-to-github-actions

Conversation

@sirbrillig

@sirbrillig sirbrillig commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Proposed changes

This migrates CI from CircleCI to GitHub Actions and upgrades PHPUnit from 5.x to 9.x, adding test coverage across PHP 7.4, 8.0, 8.1, and 8.2.

  • Remove .circleci/config.yml and add .github/workflows/tests.yml with a PHP version matrix (7.4, 8.0, 8.1, 8.2)
  • Bump phpunit/phpunit from ^5.2 to ^9.5
  • Pin doctrine/instantiator to ^1.5 to prevent composer resolving a PHP 8.4-only version from the lock file
  • Replace removed PHPUnit_Framework_* class aliases with namespaced equivalents (PHPUnit\Framework\TestCase, PHPUnit\Framework\Constraint\Constraint, etc.)
  • Replace setExpectedException() with expectException() in tests (removed in PHPUnit 6)
  • Replace assertContains() on strings with assertStringContainsString() (changed in PHPUnit 9)
  • Add void return types to tearDown() overrides to match PHPUnit 9's signature
  • Declare explicit class properties on MockObject, MatchPattern, MatchArray, FalseyValue, and Expectation to replace dynamic property creation, which is deprecated in PHP 8.2 and treated as an error by PHPUnit's error handler
  • Refactor MockObject to store method stubs in a private $methods array instead of as dynamic properties
  • Update UnmetExpectationException to extend \RuntimeException since PHPUnit\Framework\ExpectationFailedException became final in PHPUnit 9

Why are these changes being made?

CircleCI requires a separate account and integration, while GitHub Actions is built into the repository with no additional setup. The existing CI only tested PHP 7.4; expanding the matrix to include PHP 8.x makes sense given that recent PRs have been fixing PHP 8 compatibility issues.

PHPUnit 5.x does not support PHP 8 at all — composer install fails outright on PHP 8.x with the old lock file. Upgrading to PHPUnit 9.x (which supports PHP 7.3 through 8.2) was the minimum version that covers the full matrix. The PHP 8.2 dynamic property deprecations were being promoted to test errors by PHPUnit's error handler, so those were fixed in source as well rather than just suppressed.

Testing instructions

TC:

composer install && composer test

Manual testing:

  • All 216 tests pass locally on PHP 8.4
  • GitHub Actions matrix runs on PHP 7.4, 8.0, 8.1, and 8.2 — confirm all four jobs green on this PR

Replace the CircleCI config with a GitHub Actions workflow that runs
PHPUnit across a matrix of PHP versions (7.4, 8.0, 8.1, 8.2).
- Bump phpunit/phpunit constraint to ^9.5
- Replace removed PHPUnit_Framework_* class aliases with namespaced
  equivalents (PHPUnit\Framework\TestCase, Constraint\Constraint, etc.)
- Replace setExpectedException() with expectException()
- Replace assertContains() on strings with assertStringContainsString()
- Add void return types to setUp/tearDown overrides
- Declare explicit class properties to replace dynamic property creation,
  which is deprecated in PHP 8.2 and was being converted to errors by PHPUnit
- Store MockObject method stubs in a $methods array instead of dynamic properties
- Update UnmetExpectationException to extend RuntimeException since
  PHPUnit\Framework\ExpectationFailedException is now final
doctrine/instantiator 2.x requires PHP ^8.4, which breaks composer install
on the PHP 7.4/8.0/8.1/8.2 matrix. Pinning to ^1.5 (supports PHP 7.1+)
ensures the lock file is valid across all CI matrix versions.
@sirbrillig sirbrillig changed the title Migrate CI from CircleCI to GitHub Actions Migrate CI to GitHub Actions and upgrade PHPUnit for PHP 8 compatibility Apr 26, 2026
@sirbrillig sirbrillig merged commit a88dccf into master Apr 26, 2026
8 checks passed
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