You are here

function ProfileTestSelect::testProfileSelectionField in Drupal 7

Create a list selection field, give it a value, update and delete the field.

File

modules/profile/profile.test, line 223
Tests for profile.module.

Class

ProfileTestSelect

Code

function testProfileSelectionField() {
  $this
    ->drupalLogin($this->admin_user);
  $edit = array(
    'options' => implode("\n", range(1, 10)),
  );
  $field = $this
    ->createProfileField('selection', 'simpletest', $edit);
  $this
    ->setProfileField($field, rand(1, 10));
  $edit = array(
    'name' => $field['form_name'],
    'title' => $this
      ->randomName(),
    'category' => $field['category'],
    'explanation' => $this
      ->randomName(),
  );
  $field = $this
    ->updateProfileField($field['fid'], $field['type'], $edit);
  $this
    ->deleteProfileField($field);
}