/** * @param int $imageId * * @throws \Exception * * @return \Illuminate\Http\RedirectResponse */ public function destroy(int $imageId) { $this->imageRepository->deleteById($imageId); return $this->redirectToImagesIndex(); }
/** * Should be able to delete an image by ID. */ public function testDeleteById() { $this->imageResource->shouldReceive('where->limit->delete')->atLeast()->once()->andReturn(true); $deleted = $this->imageRepository->deleteById($this->generator()->anyInteger()); $this->assertTrue($deleted); }