Command-line Interface
Testbench provides support for a command line tool equivalent to artisan command where you can interact directly with the stub Laravel application.
For example instead of refreshing the database on every test you may now seed the database before running phpunit, using:
vendor/bin/testbench migrateor, you can setup the application such as installing Passport:
vendor/bin/testbench passport:installBoth commands allow you to setup the testing environment where before you were only able to use the TestCase::setUp() method.
While the testbench CLI was originally designed to help with testing, you might be able to run other features to help package development such as running ide-helper:models etc.
NOTES & CONSIDERATIONS
The command wouldn't work for file stubbing as the generated file will be based on the booted Laravel application and not your package directories.
Available Commands
testbench CLI also introduces a few commands to help your package's development.
Create SQLite Database
This command creates database/database.sqlite on your package's Laravel skeleton. You can invoke it by running the following command:
vendor/bin/testbench package:create-sqlite-dbDrop SQLite Database
This command drop database/database.sqlite on your package's Laravel skeleton. You can invoke it by running the following command:
vendor/bin/testbench package:drop-sqlite-dbPurge Skeleton
This command will purge the skeleton and reset everything to default. You can also configure purge section under the testbench.yaml configuration files such as:
purge:
directories:
- public/vendor/*
files:
- lang/*.jsonYou can invoke it by running the following command:
vendor/bin/testbench package:purge-skeleton