/**
  * Parse data from interface and return JobApplicationEvent Object
  * @param Array $postArr Array containing POST values
  * @return JobApplicationEvent Job Application Event object
  */
 public function parseUpdateData($postArr)
 {
     $id = $postArr['txtId'];
     $event = JobApplicationEvent::getJobApplicationEvent($id);
     if (isset($postArr['cmbStatus'])) {
         $status = $postArr['cmbStatus'];
         $event->setStatus($status);
     }
     if (isset($postArr['txtNotes'])) {
         $notes = $postArr['txtNotes'];
         $event->setNotes($notes);
     }
     return $event;
 }
 /**
  * Test the sendInterviewTaskToManager function
  */
 public function testSendInterviewTaskToManager()
 {
     $jobApplication = $this->jobApplications[1];
     $jobApplication->setStatus(JobApplication::STATUS_FIRST_INTERVIEW_SCHEDULED);
     $jobApplication->save();
     $jobAppEvent = JobApplicationEvent::getJobApplicationEvent(1);
     $notifier = new RecruitmentMailNotifier();
     $mockMailer = new MockMailer();
     $notifier->setMailer($mockMailer);
     $notifier->sendInterviewTaskToManager($jobAppEvent);
     $attachments = $mockMailer->getAttachments();
     $this->assertEquals(3, count($attachments));
 }
 /**
  * Test case for getJobApplicationEvent().
  */
 public function testGetJobApplicationEvent()
 {
     $createdTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("-1 hours"));
     $eventTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("+5 days"));
     // invalid id
     try {
         $event = JobApplicationEvent::getJobApplicationEvent('12A');
         $this->fail("Exception expected");
     } catch (JobApplicationEventException $e) {
         $this->assertEquals(JobApplicationEventException::INVALID_PARAMETER, $e->getCode());
     }
     // valid id but not available
     $event = JobApplicationEvent::getJobApplicationEvent(121);
     $this->assertNull($event);
     // valid available id
     $event = JobApplicationEvent::getJobApplicationEvent(1);
     $this->assertNotNull($event);
     $this->assertEquals(1, $event->getApplicationId());
     $this->assertEquals('USR111', $event->getCreatedBy());
     $this->assertEquals(13, $event->getOwner());
     $this->assertEquals(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW, $event->getEventType());
     $this->assertEquals(JobApplicationEvent::STATUS_INTERVIEW_FINISHED, $event->getStatus());
     $this->assertEquals("1st Interview notes, here", $event->getNotes());
 }