/**
  * Test the getJobSpec function
  */
 public function testGetJobSpec()
 {
     // unknown id
     $spec = JobSpec::getJobSpec(383);
     $this->assertNull($spec);
     // invalid id
     try {
         $spec = JobSpec::getJobSpec('7da');
         $this->fail('Should throw exception');
     } catch (JobSpecException $e) {
     }
     // available spec
     $spec = JobSpec::getJobSpec(2);
     $this->assertNotNull($spec);
     $this->assertTrue($this->jobSpecs[2] == $spec);
 }
 /**
  * Get the job spec for the given job title
  * @param String $jobTitleCode The job title code
  * @return JobSpec JobSpec object or null if no job spec assigned for given job title
  */
 public function getJobSpecForJob($jobTitleCode)
 {
     $jobSpec = null;
     if (CommonFunctions::isValidId($jobTitleCode, 'JOB')) {
         $jobTitle = new JobTitle();
         $jobTitles = $jobTitle->filterJobTitles($jobTitleCode);
         if (is_array($jobTitles) && count($jobTitles) == 1) {
             $jobSpecId = $jobTitles[0][5];
             try {
                 $jobSpec = JobSpec::getJobSpec($jobSpecId);
             } catch (JobSpecException $ex) {
                 // ignore, we will be returning null
             }
         }
     }
     return $jobSpec;
 }