You are here

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

Same name and namespace in other branches
  1. 6.3 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.

2 calls to ContentCrudTestCase::updateField()
ContentCrudMultipleToSingleTest::testMultipleToSingle in tests/content.crud.test
ContentCrudSingleToMultipleTest::testSingleToMultiple in tests/content.crud.test

File

tests/content.crud.test, line 310

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;
}