Ejemplo n.º 1
0
 /**
  * Tests referencing content entities with string IDs.
  */
 public function testContentEntityReferenceItemWithStringId()
 {
     $entity = EntityTest::create();
     $entity->field_test_entity_test_string_id->target_id = $this->entityStringId->id();
     $entity->save();
     $storage = \Drupal::entityManager()->getStorage('entity_test');
     $storage->resetCache();
     $this->assertEqual($this->entityStringId->id(), $storage->load($entity->id())->field_test_entity_test_string_id->target_id);
 }
Ejemplo n.º 2
0
 /**
  * Tests referencing content entities with string IDs.
  */
 public function testContentEntityReferenceItemWithStringId()
 {
     $entity = EntityTest::create();
     $entity->field_test_entity_test_string_id->target_id = $this->entityStringId->id();
     $entity->save();
     $storage = \Drupal::entityManager()->getStorage('entity_test');
     $storage->resetCache();
     $this->assertEqual($this->entityStringId->id(), $storage->load($entity->id())->field_test_entity_test_string_id->target_id);
     // Verify that the label for the target ID property definition is correct.
     $label = $entity->field_test_taxonomy_term->getFieldDefinition()->getFieldStorageDefinition()->getPropertyDefinition('target_id')->getLabel();
     $this->assertTrue($label instanceof TranslatableMarkup);
     $this->assertEqual($label->render(), 'Taxonomy term ID');
 }