1 entityreference.taxonomy.test public EntityReferenceTaxonomyTestCase::testIndexDuplicates()

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

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

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'] = 'post';
  $settings['field_entityreference_term2'][LANGUAGE_NONE][0]['target_id'] = $tid;
  $node = $this->backdropCreateNode($settings);

  $this->assertEqual(taxonomy_select_nodes($tid), array($node->nid));
}