You are here

function field_test_rename_bundle in SimpleTest 7

Rename a bundle for test_entity objects.

Parameters

$bundle_old: The machine-readable name of the bundle to rename.

$bundle_new: The new machine-readable name of the bundle.

File

tests/field_test.module, line 133

Code

function field_test_rename_bundle($bundle_old, $bundle_new) {
  $bundles = variable_get('field_test_bundles', array(
    'test_bundle' => array(
      'label' => 'Test Bundle',
    ),
  ));
  $bundles[$bundle_new] = $bundles[$bundle_old];
  unset($bundles[$bundle_old]);
  variable_set('field_test_bundles', $bundles);
  $info = field_test_entity_info();
  foreach ($info as $type => $type_info) {
    field_attach_rename_bundle($type, $bundle_old, $bundle_new);
  }
}