- What is spiral/testing used for?
- It is the official testing SDK for the Spiral Framework, not Laravel. It provides a TestCase and TestApp implementation for testing Spiral applications and packages with PHPUnit. It lets you configure bootloaders and a root directory without building extra application classes.
- Does spiral/testing work with Laravel?
- No. It has no Laravel service provider, no Illuminate Foundation Testing integration, and no compatibility with Laravel's TestCase, RefreshDatabase, HTTP kernel, or container. If your application is Laravel, this package is out of scope.
- How do I install spiral/testing?
- Install it as a dev dependency with composer require spiral/testing --dev. Your environment must meet PHP 8.1+ and Spiral Framework 3.15+. Then extend the package TestCase in your test suite.
- How do I configure spiral/testing for package tests?
- Extend the package TestCase and implement rootDirectory() to point at your package root. Implement defineBootloaders() to list the bootloaders your package needs. This lets the SDK build a test app without a full application skeleton.
- Which PHPUnit version does spiral/testing require?
- The SDK tracks PHPUnit majors and has had breaking bumps, including 3.0.0 moving to PHPUnit 13.0.5. Older releases handled specific conflicts, such as 2.9.1 for PHPUnit 10.5.46. Check the release you pin against your PHPUnit major before upgrading.
- Which Spiral Framework version is required by spiral/testing?
- The current SDK has a hard floor of Spiral Framework 3.15+. Earlier SDK versions had different framework floors; for example, 2.7.0 was needed for Spiral 3.12 dispatchers. Upgrade the SDK and framework in lockstep.
- What fakes are available in spiral/testing?
- It includes fakes for HTTP with middleware controls and JSON helpers, event dispatcher assertions such as assertDispatched and assertListening, queue payloads, console and scaffolder commands, config fragments, and container bindings. These cover the surfaces Spiral apps commonly need in integration tests.
- Can spiral/testing handle long-running worker state between requests?
- It is designed for Spiral's RoadRunner-first, long-running-worker model, including scope bindings, current-scope containers, and finalizers per request. Recent releases added finalizer calls after each FakeHTTP request and a TestScope attribute. Still, smoke-test your own long-running-state scenarios because container leakage has been a historical risk.
- Is spiral/testing actively maintained and safe to use in production?
- It is a dev-only dependency and should be added to require-dev, not installed in production. The changelog shows continuous, small, purposeful fixes from identifiable Spiral core maintainers, despite low external adoption. Run composer install --no-dev for production deployments.
- What are alternatives to spiral/testing?
- If you are on Spiral, the official SDK is the intended harness; there is no direct Laravel or Symfony KernelTestCase adapter. For Laravel apps, use Laravel's own testing tools or Pest's Laravel plugin instead. For generic PHP, PHPUnit alone may work, but you lose Spiral-specific fakes and bootloader handling.