function field_test_create_stub_entity
Creates a basic test_entity entity.
46 calls to field_test_create_stub_entity()
- EntityPropertiesTestCase::testEntityKeys in modules/
field/ tests/ field.test  - Tests entity_extract_ids() with an empty entity info.
 - EntityPropertiesTestCase::testEntityLabel in modules/
field/ tests/ field.test  - Tests label key and label callback of an entity.
 - FieldAttachOtherTestCase::testFieldAttachCache in modules/
field/ tests/ field.test  - Test field cache.
 - FieldAttachOtherTestCase::testFieldAttachForm in modules/
field/ tests/ field.test  - Test field_attach_form().
 - FieldAttachOtherTestCase::testFieldAttachPrepareViewMultiple in modules/
field/ tests/ field.test  - Tests the 'multiple entity' behavior of field_attach_prepare_view().
 
1 string reference to 'field_test_create_stub_entity'
- ListDynamicValuesTestCase::setUp in modules/
field/ modules/ list/ tests/ list.test  - Set the default field storage backend for fields created during tests.
 
File
- 
              modules/
field/ tests/ field_test.entity.inc, line 216  
Code
function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = 'test_bundle', $label = '') {
  $entity = new stdClass();
  // Only set id and vid properties if they don't come as NULL (creation form).
  if (isset($id)) {
    $entity->ftid = $id;
  }
  if (isset($vid)) {
    $entity->ftvid = $vid;
  }
  $entity->fttype = $bundle;
  $label = !empty($label) ? $label : $bundle . ' label';
  $entity->ftlabel = $label;
  return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.