Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,8 @@ public function deleteEverything()
}
}

$this->delete();

return true;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/Unit/ContactTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1121,4 +1121,18 @@ public function test_it_fetches_the_partial_contact_who_belongs_to_a_real_contac
$foundContact->id
);
}

public function test_contact_deletion()
{
$account = factory('App\Account')->create([]);
$contact = factory(Contact::class)->create(['account_id' => $account->id]);
$contact->save();
$id = $contact->id;

$this->assertEquals(1, Contact::where('id', $id)->count());

$contact->deleteEverything();

$this->assertEquals(0, Contact::where('id', $id)->count());
}
}