codeception/module-doctrine
Doctrine module for Codeception to integrate ORM/DBAL in your tests. Provides helpers for fetching and asserting entities, managing the EntityManager, and cleaning up the database between runs, enabling fast, reliable functional and acceptance testing.
Architecture Fit
The Codeception/module-doctrine package (v3.3.0) is a Doctrine ORM module for Codeception, a PHP testing framework. It integrates seamlessly with Laravel applications leveraging Doctrine ORM (e.g., via doctrine/orm or laravel-doctrine) for database interactions in tests. The package abstracts Doctrine-specific test logic (e.g., entity hydration, repository access) into Codeception modules, making it ideal for projects requiring hybrid testing (PHPUnit + Codeception) or Doctrine-centric test suites.
Integration Feasibility
laravel-doctrine/orm).Technical Risk
doctrine/collections:2.4 may impact custom Doctrine configurations using deprecated APIs.Reflection*::setAccessible() (reduces warnings, aligns with PHP 8+ best practices).Key Questions
DoctrineModule configuration in codeception.yml).Stack Fit
doctrine/orm or laravel-doctrine/orm).codeception/codeception package).Migration Path
composer require --dev codeception/module-doctrine:^3.3.0 doctrine/orm:^3.0 doctrine/collections:^2.4
codeception.yml to ensure DoctrineModule aligns with new features (e.g., lazy loading).modules:
enabled:
- Doctrine:
cleanup: true # Ensure lazy objects are handled
transaction: true
Reflection changes (PR #44) or Doctrine collections (PR #46).Sequencing
DoctrineModule (e.g., entity CRUD tests).Maintenance
Reflection warnings (PR #44) improves test logs.Support
setAccessible() removals may require reviewing Doctrine event listeners.codeception debug to isolate module-specific problems.Scaling
Failure Modes
| Risk | Impact | Mitigation |
|---|---|---|
| PHP 8.1 incompatibility | Blocking upgrade | Pin to v3.2.x or upgrade PHP |
| Doctrine collections deprec | Custom code breaks | Review doctrine/collections usage |
| Lazy object CI failures | Flaky tests in Symfony 8 | Update CI Doctrine config |
| Reflection changes | Custom test helpers break | Audit Reflection usage in tests |
Ramp-Up
DoctrineModule.codeception.yml and CI configurations.php -v check in CI to enforce PHP 8.2+.jobs:
test:
runs-on: ubuntu-latest
steps:
- run: php -r "if (version_compare(phpversion(), '8.2.0') < 0) exit(1);"
How can I help you explore Laravel packages today?