function ProfileTestDate::testProfileDateField
Create a date field, give it a value, update and delete the field.
File
-
modules/
profile/ profile.test, line 256
Class
Code
function testProfileDateField() {
$this->drupalLogin($this->admin_user);
variable_set('date_format_short', 'm/d/Y - H:i');
$field = $this->createProfileField('date');
// Set date to January 09, 1983
$edit = array(
$field['form_name'] . '[month]' => 1,
$field['form_name'] . '[day]' => 9,
$field['form_name'] . '[year]' => 1983,
);
$this->drupalPost('user/' . $this->normal_user->uid . '/edit/' . $field['category'], $edit, t('Save'));
// Check profile page.
$this->drupalGet('user/' . $this->normal_user->uid);
$this->assertText($field['title'], format_string('Found profile field with title %title', array(
'%title' => $field['title'],
)));
$this->assertText('01/09/1983', 'Found date profile field.');
$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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.