PHPUnit 9 was released with a focus on cleaning up deprecated APIs rather than adding new features. Key breaking changes include: removal of optional parameters from assertEquals() (replaced by assertEqualsWithDelta, assertEqualsCanonicalizing, assertEqualsIgnoringCase), removal of string haystack support from assertContains(), removal of assertInternalType() in favor of type-specific methods like assertIsArray(), removal of assertArraySubset(), removal of assertion methods for non-public properties, and removal of @expectedException annotation support. PHPUnit 9 requires PHP 7.3+. The post explains the philosophy behind annual major version releases: functionality is deprecated one year before removal, giving developers time to adapt incrementally. The author also discusses ongoing evolutionary refactoring efforts including XML config rewriting and a planned event-based extension system.

15m read timeFrom phpunit.expert
Post cover image
Table of contents
Do not fear major versionsWhy does PHPUnit remove functionality?PHP 7.3 RequirementassertEquals()assertContains()assertInternalType()assertArraySubset()Non-public propertiesExpecting exceptionsLet's start from scratch!Conclusion

Sort: