You are here

function field_test_create_stub_entity in SimpleTest 7

Helper function to create a basic 'test entity' structure.

TODO : do we stil need this now that we can actualy load and save test_entities ?

2 calls to field_test_create_stub_entity()
field_test_entity_form_submit_builder in tests/field_test.module
Build a test_entity by processing submitted form values and prepare for a form rebuild.
field_test_entity_form_validate in tests/field_test.module
Validate handler for field_test_set_field_values().

File

tests/field_test.module, line 181

Code

function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = FIELD_TEST_BUNDLE) {
  $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;
  return $entity;
}