TestDatabases
trait TestDatabases (View source)
Properties
| static protected bool | $schemaIsUpToDate | Indicates if the test database schema is up to date. |
Methods
Boot a test database.
Ensure a test database exists and returns its name.
Ensure the current database test schema is up to date.
Runs the given callable using the given database.
Apply the given callback when tests are not using in memory database.
Switch to the given 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.
Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.