Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

iamkirkbater/soft-deletes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages