symfony-cmf/testing
Testing utilities for Symfony CMF projects, providing helpers and base classes to simplify PHPUnit-based integration and functional tests. Speeds up setting up test environments and common CMF scenarios with reusable tooling.
RouteServiceProvider), and testing helpers (e.g., create(), assertDatabaseHas()) differ fundamentally from Symfony’s.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony-Specific Logic | High | Abstract or rewrite Symfony CMF dependencies (e.g., replace CmfRoutingBundle mocks with Laravel equivalents). |
| Testing Framework Conflicts | Medium | Ensure compatibility with Laravel’s PHPUnit/Pest setup (e.g., avoid Symfony’s KernelTestCase). |
| Maintenance Overhead | High | Port only high-value utilities; avoid deep coupling to Symfony components. |
| Documentation Gaps | Medium | Create a Laravel adaptation guide mapping Symfony CMF concepts to Laravel equivalents. |
| License Compatibility | Low | "NOASSERTION" is permissive, but ensure no conflicts with Laravel’s MIT license. |
tests/CreatesApplicationTrait, DatabaseMigrations)?laravel-shift/testing or spatie/laravel-test-factory?orchestra/testbench, mockery) that already solve similar problems?create(), assertDatabaseHas(), or followRedirects() could be extended with CMF-specific variants (e.g., assertRouteGenerated()).DatabaseMigrations or RefreshDatabase traits.| Phase | Action | Tools/Dependencies |
|---|---|---|
| Assessment | Audit existing Laravel test suite for boilerplate patterns (e.g., repeated setup in setUp()). Identify gaps where Symfony CMF utilities could help. |
PHPStan, manual review. |
| Extraction | Isolate generic test utilities (e.g., data factories, HTTP client helpers) from Symfony CMF-specific code. Rewrite using Laravel’s equivalents (e.g., Http::fake() instead of Symfony’s HttpClient). |
PHPUnit, Laravel’s HTTP testing, mockery. |
| Adaptation | Replace Symfony CMF dependencies with Laravel alternatives: |
CmfRoutingBundle → Custom route assertion helpers.PhpCr fixtures → Laravel’s Factory or TestData packages.Kernel → Laravel’s TestingPipeline. | spatie/laravel-test-factory, orchestra/testbench, mockery. |
| Validation | Run parallel test suites: Original Symfony CMF tests vs. adapted Laravel tests to ensure behavioral parity. | CI pipelines, mutation testing (e.g., infection). |
| Integration | Merge adapted utilities into Laravel’s test suite. Document breaking changes and Laravel-specific configurations. | Custom README.md, phpdoc annotations. |ContainerInterface with Laravel’s Container.EventDispatcher tests to Laravel’s Events facade.Route facade or URL::to().CmfCoreBundle, RoutingBundle, or WorkflowBundle would need complete rewrites.TestCase or RefreshDatabase.Artisan or Process facade.CmfWebTestCase → LaravelCmfTestCase).laravel-cmf-testing) with dual maintenance (Symfony + Laravel).symfony-cmf/testing updates (risk of divergence).laravel-cmf-testing package with a clear separation of concerns (e.g., shared utilities vs. CMF-specific logic).How can I help you explore Laravel packages today?