WorklistPatient::getWorklistAttributeValue PHP Method

getWorklistAttributeValue() public method

public getWorklistAttributeValue ( WorklistAttribute $attr )
$attr WorklistAttribute
    public function getWorklistAttributeValue(WorklistAttribute $attr)
    {
        foreach ($this->worklist_attributes as $wa) {
            if ($wa->worklist_attribute_id == $attr->id) {
                return $wa->attribute_value;
            }
        }
    }

Usage Example

 /**
  * @dataProvider getWorklistAttributeValueProvider
  *
  * @param $wp_attrs
  * @param $attr
  * @param $expected
  */
 public function test_getWorklistAttributeValue($wp_attrs, $attr, $expected)
 {
     $worklist_attribute = ComponentStubGenerator::generate('WorklistAttribute', $attr);
     $worklist_patient_attrs = array();
     foreach ($wp_attrs as $attr) {
         $worklist_patient_attrs[] = ComponentStubGenerator::generate('WorklistPatientAttribute', $attr);
     }
     $worklist_patient = new WorklistPatient();
     $worklist_patient->worklist_attributes = $worklist_patient_attrs;
     $this->assertEquals($expected, $worklist_patient->getWorklistAttributeValue($worklist_attribute));
 }