public function testGetReviwerEmployeeList() { $array = array(0 => 1); $daoMock = $this->getMock("PerformanceReviewDao", array("getReviwerEmployeeList")); $daoMock->expects($this->any())->method('getReviwerEmployeeList')->will($this->returnValue(array(1))); $service = new PerformanceReviewService(); $service->setDao($daoMock); $result = $service->getReviwerEmployeeList(2); $this->assertEquals($array, $result); }
/** * * @return jsonString */ public function getReviwerAccessibleEmployeeListAsJson() { $jsonArray = array(); $performanceReviewService = new PerformanceReviewService(); $performanceReviewList = $performanceReviewService->getReviwerEmployeeList($this->getUser()->getEmployeeNumber()); $employeeUnique = array(); foreach ($performanceReviewList as $performanceReview) { $employee = $performanceReview->getEmployee(); $workShiftLength = 0; $employeeCountry = null; $terminationId = $employee->getTerminationId(); if (!isset($employeeUnique[$employee->getEmpNumber()]) && empty($terminationId)) { $name = $employee->getFullName(); $employeeUnique[$employee->getEmpNumber()] = $name; $jsonArray[] = array('name' => $name, 'id' => $employee->getEmpNumber()); } } $jsonString = json_encode($jsonArray); return $jsonString; }