public function CommerceProductReferenceSelectSynonymsWebTestCase::setUp in Synonyms 7
SetUp method.
Overrides AbstractSelectSynonymsWebTestCase::setUp
File
- synonyms_commerce/
synonyms_commerce.test, line 277 - Tests for the Synonyms Commerce module.
Class
- CommerceProductReferenceSelectSynonymsWebTestCase
- Test synonyms-friendly select widget for commerce product reference field.
Code
public function setUp($modules = array()) {
$modules[] = 'commerce_product_reference';
$modules[] = 'synonyms_commerce';
$this->fields['enabled']['instance']['entity_type'] = 'commerce_product';
$this->fields['enabled']['instance']['bundle'] = 'product';
$this->fields['disabled']['instance']['entity_type'] = 'commerce_product';
$this->fields['disabled']['instance']['bundle'] = 'product';
$this->behavior_implementation['entity_type'] = $this->fields['enabled']['instance']['entity_type'];
parent::setUp($modules);
$this->reference_field = array(
'type' => 'commerce_product_reference',
'field_name' => 'synonyms_commerce',
'cardinality' => FIELD_CARDINALITY_UNLIMITED,
'settings' => array(),
);
$this->reference_field = field_create_field($this->reference_field);
$this->reference_instance = array(
'field_name' => $this->reference_field['field_name'],
'entity_type' => $this->entity_type,
'bundle' => $this->bundle,
'label' => 'Synonym Commerce Select',
'widget' => array(
'type' => 'synonyms_commerce_select',
),
);
$this->reference_instance = field_create_instance($this->reference_instance);
}