This repository has been archived on 2025-01-19. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
$this->assertEqual(array_keys($terms),$result,'Taxonomy terms were retrieved by entity query.');
$tid=reset($result);
$ids=(object)array(
'entity_type'=>'taxonomy_term',
'entity_id'=>$tid,
'bundle'=>$this->vocabulary->id(),
);
$term=_field_create_entity_from_ids($ids);
$this->assertEqual($term->id(),$tid,'Taxonomy term can be created based on the IDs.');
// Create a second vocabulary and five more terms.
$vocabulary2=$this->createVocabulary();
$terms2=array();
for($i=0;$i<5;$i++){
$term=$this->createTerm($vocabulary2);
$terms2[$term->id()]=$term;
}
$result=\Drupal::entityQuery('taxonomy_term')
->condition('vid',$vocabulary2->id())
->execute();
sort($result);
$this->assertEqual(array_keys($terms2),$result,format_string('Taxonomy terms from the %name vocabulary were retrieved by entity query.',array('%name'=>$vocabulary2->label())));
$tid=reset($result);
$ids=(object)array(
'entity_type'=>'taxonomy_term',
'entity_id'=>$tid,
'bundle'=>$vocabulary2->id(),
);
$term=_field_create_entity_from_ids($ids);
$this->assertEqual($term->id(),$tid,'Taxonomy term can be created based on the IDs.');