public function testDeleteById() { $bookmarkId = 1; $this->bookmarkMock->expects($this->once())->method('getId')->willReturn($bookmarkId); $this->bookmarkResourceMock->expects($this->once())->method('load')->with($this->bookmarkMock, $bookmarkId)->willReturn($this->bookmarkMock); $this->bookmarkResourceMock->expects($this->once())->method('delete')->with($this->bookmarkMock); $this->assertTrue($this->bookmarkRepository->deleteById($bookmarkId)); }
/** * Delete bookmark. * * @param BookmarkInterface $bookmark * @return bool true on success * @throws CouldNotDeleteException */ public function delete(BookmarkInterface $bookmark) { try { $this->bookmarkResourceModel->delete($bookmark); } catch (\Exception $exception) { throw new CouldNotDeleteException(__($exception->getMessage())); } return true; }