'field_name' => 'field_tags',
'entity_type' => 'node',
'bundle' => 'page',
])->
save();
$node = Node::
create([ 'type' => 'page',
'title' => 'test_title',
'field_tags' =>
[$term->
id()],
]);
$node->
save();
$taxonomy_index =
$this->
getTaxonomyIndex();
$this->
assertEquals($term->
id(),
$taxonomy_index[$node->
id()]->tid
);
// Normal new revision.
$node->
setNewRevision(TRUE
);
$node->
isDefaultRevision(TRUE
);
$node->field_tags->target_id =
$term2->
id();
$node->
save();
$taxonomy_index =
$this->
getTaxonomyIndex();
$this->
assertEquals($term2->
id(),
$taxonomy_index[$node->
id()]->tid
);