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 connection specified in the given model.
Get the table column name used for soft deletes.
Seed a given database connection.
Details
at line 29
protected $this
assertDatabaseHas(Model>|Model|Model>|string $table, array $data = [], null|string $connection = null)
Assert that a given where condition exists in the database.
at line 70
protected $this
assertDatabaseMissing(Model>|Model|Model>|string $table, array $data = [], null|string $connection = null)
Assert that a given where condition does not exist in the database.
at line 111
protected $this
assertDatabaseCount(Model|string $table, int $count, null|string $connection = null)
Assert the count of table entries.
at line 128
protected $this
assertDatabaseEmpty(Model>|Model|Model>|Model|string>|string $table, null|string $connection = null)
Assert that the given table or tables has no entries.
at line 155
protected $this
assertSoftDeleted(Model>|Model|Model>|Model|string>|string $table, array $data = [], null|string $connection = null, null|string $deletedAtColumn = 'deleted_at')
Assert the given record has been "soft deleted".
at line 203
protected $this
assertNotSoftDeleted(Model>|Model|Model>|Model|string>|string $table, array $data = [], null|string $connection = null, null|string $deletedAtColumn = 'deleted_at')
Assert the given record has not been "soft deleted".
at line 248
protected $this
assertModelExists(Model>|Model|Model>|string $model)
Assert the given model exists in the database.
at line 259
protected $this
assertModelMissing(Model>|Model|Model>|string $model)
Assert the given model does not exist in the database.
at line 271
$this
expectsDatabaseQueryCount(int $expected, null|string $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 314
Expression
castAsJson(array|object|string $value, null|string $connection = null)
Cast a JSON string to a database compatible type.
at line 338
protected Connection
getConnection(null|string $connection = null, null|Model>|Model|string $table = null)
Get the database connection.
at line 359
protected string
getTable(Model>|Model|string $table)
Get the table name from the given model or string.
at line 374
protected null|string
getTableConnection(Model>|Model|string $table)
Get the table connection specified in the given model.
at line 390
protected string
getDeletedAtColumn(string $table, string $defaultColumnName = 'deleted_at')
Get the table column name used for soft deletes.
at line 401
protected null|Model
newModelFor(Model|string $table)
Get the model entity from the given model or string.
at line 411
InteractsWithDatabase
seed(array|string $class = 'Database\Seeders\DatabaseSeeder')
Seed a given database connection.