public function CommerceProductReferenceAutocompleteSynonymsWebTestCase::setUp in Synonyms 7
SetUp method.
Overrides AbstractAutocompleteSynonymsWebTestCase::setUp
File
- synonyms_commerce/
synonyms_commerce.test, line 24 - Tests for the Synonyms Commerce module.
Class
- CommerceProductReferenceAutocompleteSynonymsWebTestCase
- Test synonyms autocomplete widget for commerce product reference field type.
Code
public function setUp($modules = array()) {
$modules[] = 'commerce_product_reference';
$modules[] = 'commerce_product_ui';
$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 Autocomplete',
'settings' => array(
'referenceable_types' => drupal_map_assoc(array(
'product',
)),
),
'widget' => array(
'type' => 'synonyms_commerce_autocomplete',
),
);
$this->reference_instance = field_create_instance($this->reference_instance);
$this->reference_instance = field_info_instance($this->reference_instance['entity_type'], $this->reference_instance['field_name'], $this->reference_instance['bundle']);
}