You are here

public function EntityReferenceTaxonomyTestCase::testIndexDuplicates in Entity reference 7

Make sure the index only contains one entry for a given node->term reference, even when multiple ER fields link from the node bundle to terms.

File

tests/entityreference.taxonomy.test, line 150

Class

EntityReferenceTaxonomyTestCase
Test for Entity Reference taxonomy integration.

Code

public function testIndexDuplicates() {

  // Extra setup for this test: add another ER field on this content type.
  $this
    ->setupForIndexDuplicates();

  // Assert node insert with reference to term in first field.
  $tid = 1;
  $settings = array();
  $settings['type'] = 'article';
  $settings['field_entityreference_term'][LANGUAGE_NONE][0]['target_id'] = $tid;
  $node = $this
    ->drupalCreateNode($settings);
  $this
    ->assertEqual(taxonomy_select_nodes($tid), array(
    $node->nid,
  ));
}