TestDatabases
trait TestDatabases (View source)
Properties
static protected bool | $schemaIsUpToDate | Indicates if the test database schema is up to date. |
Methods
void | bootTestDatabase()
Boot a test database. | |
array | ensureTestDatabaseExists(string $database)
Ensure a test database exists and returns its name. | |
void | ensureSchemaIsUpToDate()
Ensure the current database test schema is up to date. | |
void | usingDatabase(string $database, callable $callable)
Runs the given callable using the given database. | |
void | whenNotUsingInMemoryDatabase(callable $callback)
Apply the given callback when tests are not using in memory database. | |
void | switchToDatabase(string $database)
Switch to the given database. | |
string | testDatabase($database)
Returns the test database name. |
Details
protected void bootTestDatabase()
Boot a test database.
protected array ensureTestDatabaseExists(string $database)
Ensure a test database exists and returns its name.
protected void ensureSchemaIsUpToDate()
Ensure the current database test schema is up to date.
protected void usingDatabase(string $database, callable $callable)
Runs the given callable using the given database.
protected void whenNotUsingInMemoryDatabase(callable $callback)
Apply the given callback when tests are not using in memory database.
protected void switchToDatabase(string $database)
Switch to the given database.
protected string testDatabase($database)
Returns the test database name.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/9.x/Illuminate/Testing/Concerns/TestDatabases.html