EcomDev/EcomDev_PHPUnit

Fixtures not allowing for multi-select array attributes

Closed this issue · 1 comments

I've got an attribute which is a multi-select on the product entity. It's not populating as part of the fixture load.

My fixture has:

   ship_possible_boxes: "45,46"

I'm finding its just populating with the 45, ignoring the 46.

I resolved it with this change to code, I've not created pull request as not sure on other repercussions, but worked fine for me so putting here in case others have same issue:

In class EcomDev_PHPUnit_Model_Mysql4_Fixture_AbstractEav -

protected function _getOptionIdNonAttributeSource($options, $value)
{
    if (false === stripos($value, ',')) {
        foreach ($options as $option) {
            if (strcasecmp($option['label'], $value) == 0 || $option['value'] == $value) {
                return $option['value'];
            }
        }
    } else {
        // is an array, just return the value set
        return $value;
    }

    return null;
}

I am working on implementing such a possibility for EcomDev_Fixture module.