Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document new helper and shorthand invocations #5624

Merged
merged 2 commits into from
Nov 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions database-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,18 @@ Method | Description
------------- | -------------
`$this->assertDatabaseHas($table, array $data);` | Assert that a table in the database contains the given data.
`$this->assertDatabaseMissing($table, array $data);` | Assert that a table in the database does not contain the given data.
`$this->assertDeleted($table, array $data);` | Assert that the given record has been deleted.
`$this->assertSoftDeleted($table, array $data);` | Assert that the given record has been soft deleted.

For convenience, you may pass a model to the `assertDeleted` and `assertSoftDeleted` helpers to assert the record was deleted or soft deleted, respectively, from the database based on the model's primary key.

For example, if you are using a model factory in your test, you may pass this model to one of these helpers to test your application properly deleted the record from the database:

public function testDatabase()
{
$user = factory(App\User::class)->create();

// Make call to application...

$this->assertDeleted($user);
}