kirkbater / soft-deletes
Trait to check for soft deletes in Laravel 5
Installs: 22 727
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 0
Open Issues: 0
This package is not auto-updated.
Last update: 2020-01-28 20:48:28 UTC
README
#Soft Deletes Trait for Laravel Testing
This is a trait for extending Laravel 5.1 testing functionality, to see if something has been soft-deleted in the database.
##Usage:
First, require the composer package: composer require kirkbater/soft-deletes
Then, add the soft deletes functionality to your test:
<?php use Kirkbater\Testing\SoftDeletes; class MyTestClass extends TestClass { use SoftDeletes; }
Then, write your unit tests, just like normal:
<?php ... public function tests_that_its_soft_deleted() { $user = [ "id" => 1, "first" => "Test", "last" => "Name", "username" => "txltwc" ]; $response = $this->call('delete', '/users/'.$user->id, []); $this->assertEquals(200, $response->status()); $this->seeInDatabase("users", $user); $this->seeIsSoftDeletedInDatabase("users", $user); }