Skip to main content

What is Orchestra Testbench?

Orchestra Testbench is a Laravel testing helper designed for package development. By extending Orchestra\Testbench\TestCase, you can test your package in isolation while still booting a Laravel application context. Laravel’s package documentation also recommends Testbench for package testing workflows. See Laravel Package Development.

Setup

1

Install Testbench

2

Create your base TestCase

3

Add aliases or environment overrides if needed

Use getPackageAliases() to register facade aliases for tests, similar to the aliases section in config/app.php.

Writing your first tests

Start by testing package bootstrap behavior: provider registration, facade calls, and configuration values.

Filesystem and database testing

For database tests, configure SQLite in-memory in defineEnvironment() and load your package migrations.

Testing across Laravel versions

Testbench major versions align with Laravel major versions. Check the official Version Compatibility table for updates. Use a GitHub Actions matrix to keep compatibility verified continuously. For strategy details, see Package Version Compatibility Management.

Summary

Testbench gives you a reliable, app-like test environment for package development without creating a full Laravel app manually. By covering providers, config, facades, and database behavior, you reduce regressions before release.

Laravel package development

Review package implementation fundamentals centered on service providers.

Package version compatibility management

Learn versioning strategy and CI matrix design for Laravel and Testbench.
Last modified on April 23, 2026