- How do I install and publish test stubs for Laravel 10/11 using adroit11/laravel-tests?
- Run `composer require adroit11/laravel-tests` to install, then execute `php artisan vendor:publish --tag=laravel-tests` to copy pre-built test files into your `tests/Feature` directory. The package integrates seamlessly with Laravel’s default testing structure.
- Does this package work with Pest alongside PHPUnit?
- Yes, it’s designed for both PHPUnit (Laravel’s default) and Pest. However, Pest users may need to manually adjust test file paths or naming conventions to match the package’s published stubs, as Pest often uses a different directory structure.
- What Laravel versions and PHP versions does adroit11/laravel-tests support?
- The package officially supports Laravel 10 and 11 with PHP 8.1+. While it may work on older Laravel versions, the package is not actively tested or maintained for Laravel 8/9, so use at your own risk.
- Can I customize the published test stubs or add my own assertions?
- Yes, the published stubs are meant to be extended. Override methods in the provided test classes or add custom assertions in your project’s `TestCase` or helper files. The package intentionally avoids hardcoding logic to allow flexibility.
- Will this package slow down my CI/CD pipeline due to test parallelization?
- The package doesn’t inherently support parallel test execution, but it’s compatible with PHPUnit’s `--parallel` or Pest’s `--parallel` flags. Ensure your CI environment is configured to handle parallel tests, as the package relies on Laravel’s default transaction-based testing.
- Are there any known conflicts with Laravel’s built-in test helpers or Pest plugins?
- Minimal conflicts are expected, but if you’re using custom PHPUnit configurations (e.g., `phpunit.xml`) or Pest plugins, you may need to adjust test file paths or assertions. The package assumes default Laravel testing setups.
- How does this compare to writing custom test traits or using Pest’s @test syntax?
- This package provides a full suite of reusable test stubs and helpers, reducing the effort of writing boilerplate from scratch. Pest’s `@test` syntax is more lightweight for simple cases, while custom traits offer granular control—this package strikes a balance for teams needing consistency.
- Does the package support testing Laravel queues, events, or real-time features like WebSockets?
- The package includes basic test stubs for common Laravel features, but advanced scenarios like queues, events, or WebSockets may require manual extensions. The provided helpers focus on reducing boilerplate for CRUD, API, and feature tests.
- How do I migrate an existing test suite to use this package’s structure?
- Start by publishing the package’s stubs, then gradually replace one test file at a time (e.g., `UserTest`). Update your CI pipeline to account for any path changes, and deprecate custom traits or helpers that overlap with the package’s features.
- Is adroit11/laravel-tests actively maintained? What if Laravel’s testing APIs change?
- The package shows low activity (2 stars, no dependents), so maintenance risks exist. If Laravel’s testing APIs evolve (e.g., new assertions or traits), you may need to fork or extend the package. Always test thoroughly after updates.