- How does multi-tester work with Laravel’s autoloader and PSR-4 namespaces?
- Multi-tester dynamically replaces your package in dependent projects’ vendor directories, preserving Laravel’s autoloader behavior. It respects PSR-4 namespaces defined in your composer.json and handles Symfony components (common in Laravel) seamlessly. For custom autoload-dev paths, you may need to run `composer dump-autoload` in the target project before testing.
- Can I use multi-tester to test changes against Laravel 9 and 10 simultaneously?
- Yes, multi-tester supports testing against multiple Laravel versions by cloning projects with different composer.json constraints. Use the `config` file to specify version-specific test suites or leverage GitHub Actions matrices to parallelize runs. Ensure your package’s composer.json declares support for both Laravel 9/10.
- Will multi-tester break if a dependent project uses private repositories (e.g., GitHub private packages)?
- Multi-tester relies on Git for cloning, so private repositories require SSH/HTTPS URLs with credentials. For CI/CD, use encrypted environment variables (e.g., GitHub Secrets) or SSH keys. If the private package lacks a public Packagist URL, you’ll need to manually configure the `clone` command in your multi-tester config.
- How do I configure multi-tester to run `php artisan test` instead of PHPUnit directly?
- Multi-tester defaults to PHPUnit, but you can override the test command in your `.multi-tester.yml` under the `commands` section. Add `command: php artisan test` for Laravel projects. Ensure the target project has Artisan configured and the `tests` directory is discoverable.
- Does multi-tester support parallel test execution to speed up CI pipelines?
- By default, multi-tester runs tests sequentially, but you can optimize CI pipelines by enabling `stop_on_failure: true` and splitting tests across parallel jobs (e.g., GitHub Actions matrices). For Laravel teams testing 10+ dependencies, this reduces runtime from hours to minutes.
- What happens if my package uses `replace` in composer.json (e.g., replacing Symfony components)?
- Multi-tester respects `replace` directives and will swap your package into the vendor directory while preserving the original `replace` structure. However, if the dependent project also uses `replace`, conflicts may arise. Test with a known-working Laravel package (e.g., `laravel/framework`) first to validate behavior.
- Can multi-tester validate frontend assets (e.g., Laravel Mix, Vite) in dependent projects?
- No, multi-tester focuses on PHP/Composer dependencies and does not execute npm or frontend tooling. To test assets, run `npm run dev` or `npm run build` manually in your CI pipeline or use a separate tool like `laravel-mix`’s testing utilities.
- How do I handle Laravel-specific edge cases like config/publish or service providers?
- Multi-tester doesn’t publish config files automatically, but you can simulate this by running `php artisan config:clear` or `php artisan vendor:publish` in the `commands` section of your config. For service providers, ensure your package’s `register()` method handles dynamic environments gracefully.
- What’s the best way to integrate multi-tester with Travis CI or GitHub Actions?
- For Travis CI, add `vendor/bin/multi-tester` to your `.travis.yml` under `script`. For GitHub Actions, use a custom workflow with `actions/cache` to cache vendor directories. Example: `uses: actions/cache@v3` with `paths: vendor`. Multi-tester auto-detects `.travis.yml` for streamlined setup.
- Are there alternatives to multi-tester for Laravel package testing?
- Alternatives include `phpunit-db-test-case` (for database testing) or `pestphp/pest` (for modern PHPUnit-like syntax), but neither handles cross-project dependency testing. For Laravel-specific needs, consider `orchestra/testbench` (for testing packages in Laravel apps) or custom CI scripts, though these lack multi-tester’s Composer-native swapping.