chimit's avatar

assertSoftDeleted in Lumen

How to test whether an object was soft deleted in Lumen? Laravel has an assertSoftDeleted() method, but it's not available in Lumen like many other assertions.

0 likes
2 replies
bobbybouwmann's avatar

Diving in the source code the check is basically done with a simple count query

return $this->database->table($table)
    ->where($this->data)->whereNotNull('deleted_at')->count() > 0;

You can make your own helper method if you wish for a check like this.

chimit's avatar
$this->notSeeInDatabase('posts', [
    'id' => $post->id,
    'deleted_at' => null,
]);

This should work but still is not accurate.

P.S. Strange that Lumen has only a few basic assertions :(

Please or to participate in this conversation.