Set the profile field to a random value
$field: The field that should be set.
$value: The value for the field, defaults to a random string.
The value that has been assigned to
function setProfileField($field, $value = NULL) {
if (!isset($value)) {
$value = $this
->randomName();
}
$edit = array(
$field['form_name'] => $value,
);
$this
->drupalPost('user/' . $this->normal_user->uid . '/edit/' . $field['category'], $edit, t('Save'));
// Check profile page.
$content = $this
->drupalGet('user/' . $this->normal_user->uid);
$this
->assertText($field['title'], format_string('Found profile field with title %title', array(
'%title' => $field['title'],
)));
if ($field['type'] != 'checkbox') {
// $value must be cast to a string in order to be found by assertText.
$this
->assertText("{$value}", format_string('Found profile field with value %value', array(
'%value' => $value,
)));
}
return $value;
}