/** * Testing Adding Employee Picture */ public function testAddEmployeePictureException() { $empNumber = 102; $pic = new EmpPicture(); $pic->setEmpNumber($empNumber); $pic->setFilename("pic_" . rand(0, 1000)); $mockDao = $this->getMock('EmployeeDao'); $mockDao->expects($this->once())->method('saveEmployeePicture')->with($pic)->will($this->throwException(new DaoException())); $this->employeeService->setEmployeeDao($mockDao); try { $result = $this->employeeService->saveEmployeePicture($pic); $this->fail("Exception expected"); } catch (Exception $e) { $this->assertTrue($e instanceof PIMServiceException); } }
/** * Testing Adding Employee Picture */ public function testAddEmployeePictureException() { $empNumber = 102; $pic = new EmpPicture(); $pic->setEmpNumber($empNumber); $pic->setFilename("pic_" . rand(0, 1000)); }