Skip to content

Commit

Permalink
[soft deleting] add testSoftDeleteAfterRestoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
TBlindaruk committed Jun 1, 2018
1 parent f8706fc commit bbc9de8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,24 @@ public function testRestoreAfterSoftDelete()
$this->assertEquals($userModel->id, SoftDeletesTestUser::find(2)->id);
}

/**
* @throws \Exception
*/
public function testSoftDeleteAfterRestoring()
{
$this->createUsers();

/** @var SoftDeletesTestUser $userModel */
$userModel = SoftDeletesTestUser::withTrashed()->find(1);
$userModel->restore();
$this->assertEquals($userModel->deleted_at, SoftDeletesTestUser::find(1)->deleted_at);
$this->assertEquals($userModel->getOriginal('deleted_at'), SoftDeletesTestUser::find(1)->deleted_at);
$userModel->delete();
$this->assertNull(SoftDeletesTestUser::find(1));
$this->assertEquals($userModel->deleted_at, SoftDeletesTestUser::withTrashed()->find(1)->deleted_at);
$this->assertEquals($userModel->getOriginal('deleted_at'), SoftDeletesTestUser::withTrashed()->find(1)->deleted_at);
}

public function testUpdateOrCreate()
{
$this->createUsers();
Expand Down

0 comments on commit bbc9de8

Please sign in to comment.