/** * Testing getLicense */ public function testGetLicense() { $empNumber = 121; $licenseCode = 2; $license = new EmployeeLicense(); $license->setEmpNumber($empNumber); $license->setLicenseId($licenseCode); $license->setLicenseNo('199919'); $mockDao = $this->getMock('EmployeeDao'); $mockDao->expects($this->once())->method('getLicense')->with($empNumber, $licenseCode)->will($this->returnValue($license)); $this->employeeService->setEmployeeDao($mockDao); $result = $this->employeeService->getLicense($empNumber, $licenseCode); $this->assertEquals($license, $result); }
/** * save License * @param EmployeeLicense $empLicense * @returns EmployeeLicense */ public function saveEmployeeLicense(EmployeeLicense $empLicense) { try { $empLicense->save(); return $empLicense; // @codeCoverageIgnoreStart } catch (Exception $e) { throw new DaoException($e->getMessage(), $e->getCode(), $e); } // @codeCoverageIgnoreEnd }
/** * save License * @param EmployeeLicense $empLicense * @returns boolean */ public function saveLicense(EmployeeLicense $empLicense) { try { $empLicense->save(); return true; } catch (Exception $e) { throw new DaoException($e->getMessage()); } }