adr/2025_04_07_transition_from_phpspec_to_phpunit.md
Sylius has historically used PHPSpec for unit testing, following a behavior-driven development (BDD) approach. However, maintaining PHPSpec alongside PHPUnit (which is already used for integration and functional tests) has introduced challenges in terms of maintainability, tooling, and onboarding new contributors.
To ensure long-term sustainability and align with modern PHP development practices, we need to evaluate whether continuing with PHPSpec is beneficial or if a transition to PHPUnit for unit testing is a better approach.
Consistency – how well each approach integrates with the existing Sylius testing strategy.
Maintainability – the long-term viability of each testing framework and the effort required to support it.
Developer Experience – the learning curve, IDE support, and available tooling for each approach.
Flexibility – the ability to write and structure tests in a way that supports the evolving architecture of Sylius.
Community and Ecosystem – the adoption, support, and future development of each tool within the broader PHP ecosystem.
Chosen option: Option 2: Migrate unit tests from PHPSpec to PHPUnit, because it simplifies our testing strategy, improves maintainability, and ensures Sylius remains aligned with the PHP ecosystem.