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

[6.x] Add assertDeleted for database testing #30648

Merged
merged 1 commit into from
Nov 22, 2019

Conversation

jasonmccreary
Copy link
Contributor

While there are numerous ways to test a record has been deleted, all are relatively lengthy to assert and don't communicate well.

Before

$this->assertDatabaseMissing('posts', [
    'id' => $post->id
]);

There is an assertSoftDeleted which can actually be passed a model. Upon doing so, it conveniently builds the appropriate expectations.

An assertDeleted method is symmetrical with this existing method and improves the developer experience by wrapping all the same behavior of assertDatabaseMissing in an intently named method.

After

$this->assertDeleted($post);

@driesvints driesvints changed the title Add assertDeleted for database testing [6.x] Add assertDeleted for database testing Nov 21, 2019
@jasonmccreary
Copy link
Contributor Author

If merged, glad to add a note to the docs about the new method and optionally passing a model argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants