Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Accessing a multi-select field's seleted data


#1

I created a multi-select custom field for test cases. I have a plugin to push defects to TFS. I want to be able to access that multi-select custom field and get the selected data so I can send it with the defect to TFS. The multi-select field looks like this. The name of the field is “vehicle” and this is the list.

1, Ford
2, Dodge
3, Chevy
4, VW

private function _get_all_vehicles($context)
{
$test = current($context[‘tests’]);
$vehicles = $test->case->custom_vehicle;
foreach ($vehicles as $vehicle)
{
throw new Exception($vehicle);
$result[$vehicle] = $vehicle;
}
return $result;
}

The throw new Exception($vehicle) returns the number and not the name.