You are here

function ContentCrudTestCase::updateField in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6 tests/content.crud.test \ContentCrudTestCase::updateField()
  2. 6.2 tests/content.crud.test \ContentCrudTestCase::updateField()

Updates a field instance. Also makes all future calls to functions which take an optional field use the updated one as the default.

Parameters

$settings New settings for the field instance. If the field_name or type_name keys: are missing, then they will be taken from $field.

$field The field instance to update (defaults to the last worked upon field):

Return value

The updated field instance.

5 calls to ContentCrudTestCase::updateField()
ContentCrudMultipleToSingleTest::testMultipleToSingle in tests/content.crud.test
ContentCrudSingleToMultipleTest::testSingleToMultiple in tests/content.crud.test
ContentOptionWidgetTest::testChecboxes in tests/content.crud.test
Multiple (checkboxes), not required:
ContentOptionWidgetTest::testRadios in tests/content.crud.test
Single (radios), not required:
ContentOptionWidgetTest::testSelect in tests/content.crud.test
Single select, not required:

File

tests/content.crud.test, line 326

Class

ContentCrudTestCase
Base class for CCK CRUD tests. Defines many helper functions useful for writing CCK CRUD tests.

Code

function updateField($settings, $field = NULL) {
  if (!isset($field)) {
    $field = $this->last_field;
  }
  $defaults = array(
    'field_name' => $field['field_name'],
    'type_name' => $field['type_name'],
  );
  $settings = $settings + $defaults;
  $this->last_field = content_field_instance_update($settings);
  return $this->last_field;
}