/** * @test * * @expectedException \Magento\Framework\Exception\NoSuchEntityException */ public function testGetByIdException() { $blockId = '123'; $this->block->expects($this->once())->method('getId')->willReturn(false); $this->blockResource->expects($this->once())->method('load')->with($this->block, $blockId)->willReturn($this->block); $this->repository->getById($blockId); }
/** * Delete Block * * @param Data\BlockInterface $block * @return bool * @throws CouldNotDeleteException */ public function delete(Data\BlockInterface $block) { try { $this->resource->delete($block); } catch (\Exception $exception) { throw new CouldNotDeleteException(__($exception->getMessage())); } return true; }