/** * Testing getSalary */ public function testGetSalary() { $empNumber = 121; $id = 1; $salary = new EmpBasicsalary(); $salary->setEmpNumber($empNumber); $salary->setId($id); $salary->setSalaryComponent('Travel Expenses'); $mockDao = $this->getMock('EmployeeDao'); $mockDao->expects($this->once())->method('getSalary')->with($empNumber, $id)->will($this->returnValue($salary)); $this->employeeService->setEmployeeDao($mockDao); $result = $this->employeeService->getSalary($empNumber, $id); $this->assertEquals($salary, $result); }
/** * Save EmpBasicsalary * @param EmpBasicsalary $empBasicsalary * @returns boolean * @throws DaoException */ public function saveEmpBasicsalary(EmpBasicsalary $empBasicsalary) { try { $empBasicsalary->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }