1 entityreference.taxonomy.test protected EntityReferenceTaxonomyTestCase::setupForIndexDuplicates()

Add a second ER field from node/post to taxonomy.

This should not cause {taxonomy_index} to receive duplicate entries.

File

core/modules/entityreference/tests/entityreference.taxonomy.test, line 126

Class

EntityReferenceTaxonomyTestCase
Test for Entity Reference taxonomy integration.

Code

protected function setupForIndexDuplicates() {
  // Create an entity reference field.
  $field = array(
    'entity_types' => array('node'),
    'settings' => array(
      'handler' => 'base',
      'target_type' => 'taxonomy_term',
      'handler_settings' => array(
        'target_bundles' => array(),
      ),
    ),
    'field_name' => 'field_entityreference_term2',
    'type' => 'entityreference',
  );
  $field = field_create_field($field);
  $instance = array(
    'field_name' => 'field_entityreference_term2',
    'bundle' => 'post',
    'entity_type' => 'node',
  );

  // Enable the taxonomy-index behavior.
  $instance['settings']['behaviors']['taxonomy']['status'] = TRUE;
  field_create_instance($instance);
}