- Can I use citizen63000/easy-api-tests directly in a Laravel project without conflicts?
- No, this package is designed as a Symfony bundle and won’t integrate seamlessly with Laravel. It assumes Symfony’s bundle system, which conflicts with Laravel’s service providers and autoloading. You’d need custom adapters or workarounds, like creating a Laravel service provider to bridge its services.
- What Laravel versions does this package support?
- The package is built for Symfony 6.4+, which aligns with Laravel 10+. However, Laravel 9.x or older may face dependency conflicts (e.g., Symfony 5.x vs. 6.4). Laravel <9 is incompatible due to PHP 8.1+ and Symfony 6.4 requirements.
- Does this package work with Laravel’s built-in testing tools like HttpTests or Pest?
- No, it doesn’t integrate natively. The package extends Symfony’s `WebTestCase`, which may override Laravel’s `TestCase` or conflict with traits like `RefreshDatabase`. You’d need to compose custom traits or avoid mixing them.
- How do I handle JWT authentication in Laravel with this package?
- The package supports JWT via Symfony’s security component, but Laravel’s auth system (e.g., Sanctum, Passport) may not align. You’d need to manually configure the package’s `user_class` and `user_identity_property` to match your Laravel user model, but token handling might still require custom logic.
- Will this package slow down my Laravel tests or increase memory usage?
- Yes, it pulls in full Symfony bundles (e.g., FrameworkBundle), which Laravel already provides partially. This can bloat autoload times and duplicate functionality like `HttpClient`, increasing memory usage during tests.
- Are there Laravel-native alternatives for automated API testing?
- Yes, consider Laravel’s built-in tools like `Http::fake()`, `MockHttp`, or packages like `laravel/api-test-helper`. For CRUD testing, Pest’s `create()`, `update()`, and `delete()` helpers or custom test traits can achieve similar results without Symfony dependencies.
- How do I configure this package for Laravel’s database testing (e.g., RefreshDatabase)?
- The package’s `DatabaseTestCase` may conflict with Laravel’s `RefreshDatabase` trait. You’ll need to disable the package’s database handling or manually sync transaction management. Test database setup should still rely on Laravel’s `DatabaseMigrations` or `DatabaseTransactions` traits.
- Can I use this package for testing non-CRUD API endpoints (e.g., file uploads, webhooks)?
- The package focuses on CRUD operations with JWT auth. For non-CRUD endpoints, you’d need to extend its traits manually or use Laravel’s native `JsonTestResponse` or `Pest` assertions, which are more flexible for edge cases like file uploads or webhook validation.
- What’s the long-term maintenance risk of using this package in Laravel?
- High. Since it’s Symfony-centric, future Laravel updates (e.g., dropping Symfony 6.x) could break compatibility. The package lacks Laravel-specific roadmap updates, and its bundle architecture may become obsolete as Laravel evolves away from Symfony’s full stack.
- How do I install this package in Laravel without breaking existing tests?
- Install it only in the `test` environment via Composer (`--dev`), but avoid mixing its `AbstractApiTestCase` with Laravel’s `TestCase`. Use it in isolated test classes or wrap its traits in custom Laravel-compatible classes to prevent conflicts with existing test suites.