コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:link')))->save();
 }
コード例 #2
0
 protected function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:dateCreated')))->save();
     // Set up test entity.
     $this->entity = entity_create('entity_test', array());
     $this->entity->{$this->fieldName}->value = $this->testValue;
 }
コード例 #3
0
 public function setUp()
 {
     parent::setUp();
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:email')))->save();
     // Set up test values.
     $this->testValue = '*****@*****.**';
     $this->entity = entity_create('entity_test', array());
     $this->entity->{$this->fieldName}->value = $this->testValue;
 }
コード例 #4
0
 protected function setUp()
 {
     parent::setUp();
     $this->installConfig(array('filter'));
     $this->createTestField();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:text')))->save();
     // Set up test entity.
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->value = $this->testValue;
     $this->entity->{$this->fieldName}->summary = $this->testSummary;
 }
コード例 #5
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     entity_reference_create_field($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType);
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:knows')))->save();
     // Create the entity to be referenced.
     $this->target_entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->target_entity->save();
     // Create the entity that will have the entity reference field.
     $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->target_entity;
     $this->entity->{$this->fieldName}->access = TRUE;
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
コード例 #6
0
 public function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('taxonomy_term');
     $vocabulary = entity_create('taxonomy_vocabulary', array('name' => $this->randomName(), 'vid' => drupal_strtolower($this->randomName()), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $vocabulary->save();
     entity_create('field_storage_config', array('name' => $this->fieldName, 'entity_type' => 'entity_test', 'type' => 'taxonomy_term_reference', 'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => 0)))))->save();
     entity_create('field_instance_config', array('entity_type' => 'entity_test', 'field_name' => $this->fieldName, 'bundle' => 'entity_test'))->save();
     $this->term = entity_create('taxonomy_term', array('name' => $this->randomName(), 'vid' => $vocabulary->id(), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED));
     $this->term->save();
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:about')))->save();
     // Set up test values.
     $this->entity = entity_create('entity_test');
     $this->entity->{$this->fieldName}->target_id = $this->term->id();
     $this->entity->save();
     $this->uri = $this->getAbsoluteUri($this->entity);
 }
コード例 #7
0
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('entity_test_rev');
     // Give anonymous users permission to view test entities.
     $this->installConfig(array('user'));
     Role::load(RoleInterface::ANONYMOUS_ID)->grantPermission('view test entity')->save();
     $this->createEntityReferenceField($this->entityType, $this->bundle, $this->fieldName, 'Field test', $this->entityType);
     // Add the mapping.
     $mapping = rdf_get_mapping('entity_test', 'entity_test');
     $mapping->setFieldMapping($this->fieldName, array('properties' => array('schema:knows')))->save();
     // Create the entity to be referenced.
     $this->targetEntity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->targetEntity->save();
     // Create the entity that will have the entity reference field.
     $this->entity = entity_create($this->entityType, array('name' => $this->randomMachineName()));
     $this->entity->save();
     $this->entity->{$this->fieldName}->entity = $this->targetEntity;
     $this->uri = $this->getAbsoluteUri($this->entity);
 }