public function testDeleteById() { $taxClass = $this->getMock('\\Magento\\Tax\\Model\\ClassModel', [], [], '', false); $classId = 1; $this->classModelRegistryMock->expects($this->once())->method('retrieve')->with($classId)->willReturn($taxClass); $taxClass->expects($this->once())->method('getClassId')->willReturn(1); $this->taxClassResourceMock->expects($this->once())->method('delete')->with($taxClass); $this->classModelRegistryMock->expects($this->once())->method('remove')->with(1); $this->assertTrue($this->model->deleteById($classId)); }
/** * @expectedException \Magento\Framework\Exception\NoSuchEntityException * @expectedExceptionMessage No such entity with class_id = 99999 */ public function testDeleteByIdThrowsExceptionIfTargetTaxClassDoesNotExist() { $nonexistentTaxClassId = 99999; $this->taxClassRepository->deleteById($nonexistentTaxClassId); }