/** * @param int $tagId * * @throws \Exception * * @return RedirectResponse */ public function destroy(int $tagId) { $deleted = $this->tagRepository->deleteById($tagId); if ($deleted) { $this->webUi->successMessage("Deleted tag with ID `{$tagId}`"); } else { $this->webUi->errorMessage("Failed to delete tag with ID `{$tagId}`"); } return $this->redirectToTagsIndex(); }
/** * Should be able to delete a tag by id. */ public function testDeleteById() { $this->tagModel->shouldReceive('where->first->delete')->andReturnTrue(); $this->assertTrue($this->tagRepository->deleteById(5)); }