kirkbater/soft-deletes

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0) of this package.

Trait to check for soft deletes in Laravel 5

1.0 2016-01-18 19:41 UTC

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);
}