Skip to content

feat: add Testbench for Laravel packages developed with Orchestra Testbench - #99

Open
ExeQue wants to merge 2 commits into
lerd-env:mainfrom
ExeQue:feat/testbench
Open

ExeQue wants to merge 2 commits into
lerd-env:mainfrom
ExeQue:feat/testbench

Conversation

@ExeQue

@ExeQue ExeQue commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Adds a framework definition for Laravel packages developed with Orchestra Testbench, so lerd link on a package repository serves its workbench without a hand-written .lerd.yaml.

What it does

  • Detection: a testbench.yaml file in the project root. Composer detection is left out on purpose: orchestra/testbench also sits in the require-dev of many Laravel applications, and those must stay Laravel sites. A package has neither an artisan file nor laravel/framework in its manifest, so it never matches Laravel.
  • Document root: vendor/orchestra/testbench-core/laravel/public, the Laravel skeleton Testbench boots the workbench from.
  • Console: vendor/bin/testbench, so lerd artisan runs Testbench's own commands.
  • No env wiring: Testbench takes its environment from testbench.yaml (SQLite unless the package configures something else), so the definition declares no env file and no services; lerd env reports that it is not supported, as for any definition without an env section.
  • Setup: "Discover packages" (testbench package:discover, on by default) writes the cached testbench.yaml the skeleton's public/index.php reads; without it the site does not boot. "Build the workbench" (testbench workbench:build) is opt-in, and also available as a command.
  • Logs: the skeleton's storage/logs/*.log.
  • One version only (11, Testbench for Laravel 13).

Icon

The mark (a bench vise, in slate) is a placeholder: Testbench has no official logo. Happy to swap it for an official one if Orchestra publishes one, or for whatever you prefer.

Tested

  • python3 .github/scripts/schema_guard.py against main: passes.
  • End to end with lerd on a real Testbench package (exeque/laravel-monocle), with the definition added through lerd framework add --from-file and no public_dir in .lerd.yaml: lerd link detects testbench and sets the document root above, the workbench and its routes serve, lerd artisan --version runs through Testbench, lerd setup --list-steps offers both setup steps, and lerd run workbench:build builds the workbench.

…tbench

A package with a testbench.yaml is served from its workbench: the document
root is Testbench's Laravel skeleton in vendor/, and the console is
vendor/bin/testbench. Testbench takes its environment from testbench.yaml
(SQLite unless the package says otherwise), so the definition declares no env
file and no service wiring. Setup discovers packages, which writes the cached
testbench.yaml the skeleton's index.php reads; building the workbench is an
opt-in step and a command.

The mark is a placeholder bench vise: Testbench has no official logo.
The skeleton under vendor finds the package's vendor through TESTBENCH_WORKING_PATH or a vendor symlink, and testbench removes that symlink when each command ends, so every page answered 500. The definition now passes the variable through nginx.fastcgi_params, which lerd-env/lerd#2194 adds.
@geodro

geodro commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Tried it on monocle with lerd from a fresh clone, link and setup go through and artisan runs, but with the default setup steps every page answered 500 with Failed opening required vendor/orchestra/testbench-core/laravel/vendor/autoload.php. The skeleton only finds the package vendor through a vendor symlink or TESTBENCH_WORKING_PATH, which testbench serve sets. Running workbench:build leaves the symlink in place, which is why it served for you, but Build the workbench is off by default and the composer clear script purges the symlink again on every install, require or dump-autoload, so the site goes back to 500 after the next composer run. A definition had no way to pass a fastcgi param without copying the whole php location in a snippet, which would lose profiling, LERD_SITE and the forwarded headers, so lerd-env/lerd#2194 adds nginx.fastcgi_params and I pushed d3f9a65 here using it. With both, the workbench serves after the default setup, after workbench:build and after a composer dump-autoload, with no symlink. An older lerd ignores the key and keeps today's behaviour, so this is best merged once 2194 is in a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants