InteractsWithDatabase
trait InteractsWithDatabase
Methods
Assert that a given where condition exists in the database.
Assert that a given where condition does not exist in the database.
Assert the count of table entries.
Assert that the given table or tables has no entries.
Assert the given record has been "soft deleted".
Assert the given record has not been "soft deleted".
Assert the given model does not exist in the database.
Specify the number of database queries that should occur throughout the test.
Determine if the argument is a soft deletable model.
Cast a JSON string to a database compatible type.
Get the database connection.
Get the table column name used for soft deletes.
Seed a given database connection.
Details
at line 31
protected InteractsWithDatabase
assertDatabaseHas(iterable|Model|string $table, array $data = [], UnitEnum|string|null $connection = null)
Assert that a given where condition exists in the database.
at line 71
protected InteractsWithDatabase
assertDatabaseMissing(iterable|Model|string $table, array $data = [], UnitEnum|string|null $connection = null)
Assert that a given where condition does not exist in the database.
at line 111
protected InteractsWithDatabase
assertDatabaseCount(iterable|Model|string $table, int|null $count = null, UnitEnum|string|null $connection = null)
Assert the count of table entries.
at line 135
protected InteractsWithDatabase
assertDatabaseEmpty(iterable|Model|string $table, UnitEnum|string|null $connection = null)
Assert that the given table or tables has no entries.
at line 160
protected InteractsWithDatabase
assertSoftDeleted(iterable|Model|string $table, array $data = [], UnitEnum|string|null $connection = null, string|null $deletedAtColumn = 'deleted_at')
Assert the given record has been "soft deleted".
at line 207
protected InteractsWithDatabase
assertNotSoftDeleted(iterable|Model|string $table, array $data = [], UnitEnum|string|null $connection = null, string|null $deletedAtColumn = 'deleted_at')
Assert the given record has not been "soft deleted".
at line 253
protected InteractsWithDatabase
assertModelExists(iterable|Model|string $model)
Assert the given model exists in the database.
at line 264
protected InteractsWithDatabase
assertModelMissing(iterable|Model|string $model)
Assert the given model does not exist in the database.
at line 274
InteractsWithDatabase
expectsDatabaseQueryCount(int $expected, UnitEnum|string|null $connection = null)
Specify the number of database queries that should occur throughout the test.
at line 302
protected bool
isSoftDeletableModel(mixed $model)
Determine if the argument is a soft deletable model.
at line 310
Expression
castAsJson(array|object|string $value, UnitEnum|string|null $connection = null)
Cast a JSON string to a database compatible type.
at line 332
protected Connection
getConnection(UnitEnum|string|null $connection = null, Model|string|null $table = null)
Get the database connection.
at line 354
protected string
getTable(Model|string $table)
Get the table name from the given model or string.
at line 368
protected string|null
getTableConnection(Model|string|null $table)
Get the table connection specified in the given model.
at line 382
protected string|null
getDeletedAtColumn(Model|string $table, string|null $defaultColumnName = 'deleted_at')
Get the table column name used for soft deletes.
at line 392
protected Model|null
newModelFor(Model|string|null $table)
Get the model entity from the given model or string.
at line 403
InteractsWithDatabase
seed(array|string $class = 'Database\Seeders\DatabaseSeeder')
Seed a given database connection.