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 30
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 69
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 108
protected InteractsWithDatabase
assertDatabaseCount(Model|string $table, int $count, UnitEnum|string|null $connection = null)
Assert the count of table entries.
at line 123
protected InteractsWithDatabase
assertDatabaseEmpty(iterable|Model|string $table, UnitEnum|string|null $connection = null)
Assert that the given table or tables has no entries.
at line 147
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 193
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 238
protected InteractsWithDatabase
assertModelExists(iterable|Model|string $model)
Assert the given model exists in the database.
at line 248
protected InteractsWithDatabase
assertModelMissing(iterable|Model|string $model)
Assert the given model does not exist in the database.
at line 256
InteractsWithDatabase
expectsDatabaseQueryCount(int $expected, UnitEnum|string|null $connection = null)
Specify the number of database queries that should occur throughout the test.
at line 284
protected bool
isSoftDeletableModel(mixed $model)
Determine if the argument is a soft deletable model.
at line 292
Expression
castAsJson(array|object|string $value, UnitEnum|string|null $connection = null)
Cast a JSON string to a database compatible type.
at line 314
protected Connection
getConnection(UnitEnum|string|null $connection = null, Model|string|null $table = null)
Get the database connection.
at line 334
protected string
getTable(Model|string $table)
Get the table name from the given model or string.
at line 348
protected string|null
getTableConnection(Model|string|null $table)
Get the table connection specified in the given model.
at line 362
protected string|null
getDeletedAtColumn(Model|string $table, string|null $defaultColumnName = 'deleted_at')
Get the table column name used for soft deletes.
at line 372
protected Model|null
newModelFor(Model|string|null $table)
Get the model entity from the given model or string.
at line 382
InteractsWithDatabase
seed(array|string $class = 'Database\Seeders\DatabaseSeeder')
Seed a given database connection.