Published 1 week ago by krystian2160
Laravels test suite has an assertion called
$this->assertSoftDeleted() But is there the inverse? To assert that something is not soft deleted?
I've tried assertDatabaseHas but doesn't work.
I have done it this way $this->assertTrue(! $goal->fresh()->trashed());
But is there another, better, more ---elegant--- and laravel's way?
There is no inverse of
assertSoftDeleted; in my opinion your alternative is fine except I would
If you really prefer, you could use
assertDatabaseHas as follows:
$this->assertDatabaseHas('table_name', [ 'id' => $goal->id, $goal->getDeletedAtColumn() => null ]);
... but does it express your intention better than the original?