Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Testbench Core

Testbench Core Laravel Package

orchestra/testbench-core

Orchestra Testbench Core is the foundation for testing Laravel packages. It boots a lightweight Laravel app inside your package so you can run artisan commands, migrations, routing, and more, with compatibility across Laravel 6–12.

View on GitHub
Deep Wiki
Context7

Testing Helper for Laravel Development

Frequently asked questions about Testbench Core
How do I install Orchestra Testbench Core for Laravel package testing?
Run `composer require orchestra/testbench-core` in your package directory. Testbench Core is designed to work alongside Laravel’s core, so no additional Laravel installation is required. It boots a minimal Laravel environment for testing package logic, migrations, and Artisan commands.
Which Laravel versions does Testbench Core support, and how do I check compatibility?
Testbench Core supports Laravel 6.x through 13.x, with version alignment (e.g., Testbench 11.x for Laravel 13.x). Check the [compatibility matrix](https://github.com/orchestral/testbench-core#version-compatibility) in the README. Always use matching major versions to avoid integration issues.
Can I test database interactions like migrations and seeders with Testbench Core?
Yes, Testbench Core fully supports Laravel migrations, seeders, and database interactions. Use traits like `WithMigrations` or `WithFactories` to set up your database state before tests. It resets the state between tests to prevent pollution, making it ideal for CI/CD pipelines.
How does Testbench Core handle parallel testing in PHPUnit?
Testbench Core supports parallel testing out of the box in versions 10.11.0 and above. For older versions, you may need to configure PHPUnit manually with `--parallel`. Ensure your test suite uses `flushState()` or `TerminatingConsole` to isolate test environments and avoid conflicts.
What’s the difference between Testbench Core and the full Testbench package?
Testbench Core is the foundation for testing Laravel packages, providing core functionality like booting a Laravel app, running Artisan, and managing migrations. The full [Testbench package](https://github.com/orchestral/testbench) extends this with additional helpers, while Testbench Core remains lightweight and focused on package-specific testing.
How do I test Artisan commands with Testbench Core?
Use the `Artisan::call()` method to execute commands in your tests. Testbench Core boots a full Laravel environment, so commands like `migrate`, `route:list`, or custom commands will work as expected. You can also test command output or exit codes for validation.
Does Testbench Core work with PestPHP instead of PHPUnit?
Testbench Core is primarily designed for PHPUnit but can be used with PestPHP if you manually bridge the testing environment. However, the full Testbench ecosystem (e.g., BrowserKit, Dusk) is optimized for PHPUnit. For Pest users, consider Pest’s native features or lighter alternatives if Laravel-specific testing isn’t required.
How do I reset or isolate test state between runs in Testbench Core?
Testbench Core provides `flushState()` to reset the Laravel service container and `TerminatingConsole` to clean up after tests. For database isolation, use `WithMigrations` with `refreshDatabase()` or `WithFactories` to control fixture loading. This ensures tests run in a clean environment, critical for CI/CD reliability.
Can I test UI interactions (e.g., forms, redirects) with Testbench Core?
Testbench Core alone doesn’t support UI testing, but you can extend it with [Testbench BrowserKit](https://github.com/orchestral/testbench-browser-kit) for CSS selector interactions or [Testbench Dusk](https://github.com/orchestral/testbench-dusk) for JavaScript-powered tests. Both packages build on Testbench Core’s Laravel environment.
What are the maintenance requirements for Testbench Core in production or CI pipelines?
Testbench Core requires minimal maintenance—focus on keeping it aligned with your Laravel version (e.g., update to Testbench 11.x for Laravel 13.x). Monitor the [release notes](https://github.com/orchestral/testbench-core/releases) for breaking changes. For CI, use the `package:test` command to run tests without a full Laravel install, reducing setup overhead.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codraw/framework-extra-bundle
codraw/messenger
codraw/security
codraw/mailer
codraw/contracts
codraw/profiling
codraw/dependency-injection
codraw/tester
codraw/core
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony