You are here

public function FeedsTamperEfqFinderTestCase::testTaxonomyTermByField in Feeds Tamper 7

Maps to a term by field.

File

tests/feeds_tamper_efq_finder.test, line 101
Contains FeedsTamperEfqFinderTestCase.

Class

FeedsTamperEfqFinderTestCase
Tests for the efq_finder plugin.

Code

public function testTaxonomyTermByField() {

  // Add a text field to the vocabulary.
  $edit = array(
    'fields[_add_new_field][label]' => 'Other term name',
    'fields[_add_new_field][field_name]' => 'term_name',
    'fields[_add_new_field][type]' => 'text',
    'fields[_add_new_field][widget_type]' => 'text_textfield',
  );
  $this
    ->drupalPost('admin/structure/taxonomy/terms/fields', $edit, t('Save'));

  // Create some taxonomy terms.
  foreach (array(
    1,
    2,
    3,
  ) as $id) {
    $term = new stdClass();
    $term->name = 'term ' . $id;
    $term->vid = 1;
    $term->field_term_name = array(
      'und' => array(
        array(
          'value' => 'ref ' . $id,
        ),
      ),
    );
    taxonomy_term_save($term);
  }
  $edit = array(
    'entity_type' => 'taxonomy_term',
    'bundle' => 'terms',
    'field' => 'field_term_name',
    'column' => 'value',
  );
  $this
    ->doTaxonomyTermTest($edit);
}