coders-tm/laravel-core / .agents/skills/testbench-docs
testbench-package-testing
VerifiedDevelops and tests Laravel packages using Orchestra Testbench. Activates when writing package tests, configuring testbench.yaml, managing migrations, defining routes/environment for tests, using Testbench Dusk for browser tests, or working with Workbench for package preview.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.2 KB |
| api-examples.md | markdown | 907 B |
| getting-started.md | markdown | 3.2 KB |
| getting-started/configuration.md | markdown | 5.2 KB |
| markdown-examples.md | markdown | 1.0 KB |
| testbench-dusk.md | markdown | 3.3 KB |
| testbench-dusk/the-basic.md | markdown | 3.3 KB |
| testbench-dusk/troubleshooting.md | markdown | 1.7 KB |
| testbench.md | markdown | 2.7 KB |
| testbench/cli.md | markdown | 1.9 KB |
| testbench/integrations.md | markdown | 2.0 KB |
| testbench/the-basic.md | markdown | 6.4 KB |
| testbench/the-basic/databases.md | markdown | 5.0 KB |
| testbench/the-basic/environment.md | markdown | 4.9 KB |
| testbench/the-basic/routes.md | markdown | 2.3 KB |
| testbench/troubleshooting.md | markdown | 3.5 KB |
| workbench.md | markdown | 1.2 KB |
getting-started/configuration.md
View on GitHub# Configuration
The Packages Toolkit for Laravel uses `testbench.yaml` as a configuration file where you can define the following schemas to be used within `testbench` CLI or Workbench environment:
Name | Type | Description
:----------------|:----------|:--------------------
`laravel` | `string` | Set the path to Laravel skeleton.
`providers` | `array` | List of Service Provider classes to be loaded.
`migrations` | `array` | List of migrations path.
`seeders` | `array` | List of seeder classes to execute during `migrate:fresh` or `migrate:refresh`.
`dont-discover` | `array` | List of packages to be ignored.
`bootstrappers` | `array` | Set of bootstrapper classes to be loaded.
`env` | `array` | Set environment variables to be loaded under `testbench` CLI.
`purge` | `array` | Configurable `files` and `directories` to be pruned via `package:purge-skeleton` command.
`workbench` | Object | See [Workbench configuration](#workbench-configuration) for details.
[[toc]]
## Basic Usages
For the `testbench` command to understand any required service providers, bootstrappers, environment variables or other options to be used when executing the "artisan" command you need to add the following `testbench.yaml` file on the project root directory.
```yaml
providers:
- Laravel\Passport\PassportServiceProvider
dont-discover:
- laravel/sanctum
```
### Laravel Skeleton
You can use `laravel` configuration key to set a custom location instead of using the default `vendor/orchestra/testbench-core/laravel`:
```yaml
laravel: ./skeleton
```
### Service Providers
You can use `providers` configuration key to set an array of service providers to be loaded:
```yaml
providers:
- Laravel\Sanctum\SanctumServiceProvider
- Workbench\App\Providers\WorkbenchServiceProvider
```
### Exclude Packages
Alternatively, you can also use `dont-discover` to exclude specific packages from being loaded:
```yaml
dont-discover:
- laravel/html
```
### Environment Variables
You can use `env` configuration key to set an array of environment variables to be loaded under `testbench` CLI:
```yaml
env:
- SEND_QUERIES_TO_RAY=(false)
```
::: warning `env` limitation
The `env` environment variables are only applied when using the CLI and will not be used when running tests.
:::
### Workbench Configuration
You can use `workbench` configuration key to enable Workbench integration on your Laravel packages.
Name | Type | Description
:----------------|:--------------|:--------------------
`welcome` | `bool` | Show the default Laravel welcome page when accessing `/` via `serve` command.
`install` | `bool` | Run Laravel default migrations.
`start` | `string` | Set the default route when opening `/` path via `serve` command.
`user` | `string\|int` | Set the user ID or email to automatically logged-in when accessing `/` via `serve` command (only when accessing as a guest).
`auth` | `bool` | Determine if Workbench should generate authentication routes using Laravel Breeze (default: `false`)
`guard` | `string` | Set the default Auth Guard to automatically authenticate `user` value.
`sync` | `array` | Set a collection to create symlink between `from` and `to` value via `serve` command. Set `reserve: true` will create symlink from skeleton to destination path instead of from path to skeleton.
`build` | `array` | Set a collection of build recipes or command to be execute when running `workbench:build` command.
`assets` | `array` | Set a collection of `tag` used in `vendor:publish` to be use with `asset-publish` recipe when running `workbench:build` command.
`discovers` | `array` | See [Workbench Discovery Configuration](#workbench-discovery-configuration) for details.
#### Workbench Discovery Configuration
The `discovers` configuration allows Workbench to discover routes, model factories, and views.
Name | Type | Description
:----------------|:--------------|:--------------------
`config` | `bool` | Enabling the option allows Workbench to load configuration from `workbench/config` directory.
`factories` | `bool` | Enabling the options allows Workbench to map Eloquent Models from `workbench/app/Models` directory to `workbench/database/factories`.
`web` | `bool` | Enabling the options allows Workbench to register routes from `workbench/routes/web.php`
`api` | `bool` | Enabling the options allows Workbench to register routes from `workbench/routes/api.php`
`commands` | `bool` | Enabling the options allows Workbench to register console commands from `workbench/routes/console.php`
#### Example
```yaml
workbench:
welcome: true
install: true
start: /nova
user: taylor@laravel.com
guard: web
sync:
- from: public
to: public/vendor/nova
- from: storage
to: workbench/storage
reverse: true
build:
- asset-publish
- create-sqlite-db
- migrate:refresh
assets:
- nova-assets
discovers:
web: true
api: false
commands: false
views: true
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |