protected function LocationCCK2Test::addLocationContentType2 in Location 7.3
3 calls to LocationCCK2Test::addLocationContentType2()
File
- tests/
location_cck2.test, line 68
Class
Code
protected function addLocationContentType2(&$settings, $add = array()) {
if (!self::$name) {
self::$name = strtolower($this
->randomName(8));
$form = array(
'name' => self::$name,
'type' => self::$name,
);
// creates content type
$this
->drupalPost('admin/structure/types/add', $form, 'Save content type');
$this
->assertText(t('The content type ' . self::$name . ' has been added'));
unset($form);
if (!self::$field_name) {
self::$field_name = strtolower($this
->randomName(8));
$form = array(
'fields[_add_new_field][label]' => self::$field_name,
'fields[_add_new_field][field_name]' => self::$field_name,
'fields[_add_new_field][type]' => 'location',
'fields[_add_new_field][widget_type]' => 'location',
);
// adds field
$this
->drupalPost('admin/structure/types/manage/' . self::$name . '/fields', $form, t('Save'));
unset($form);
// check field defaults
$form = array();
$this
->drupalPost(NULL, $form, t('Save field settings'));
unset($form);
$this
->assertText(t('Updated field ' . self::$field_name . ' field settings.'));
// fills field custom defaults
$form = array(
'field_' . self::$field_name . '[und][0][name]' => 'Kyiv',
'field_' . self::$field_name . '[und][0][country]' => 'ua',
'field_' . self::$field_name . '[und][0][locpick][user_latitude]' => 50,
'field_' . self::$field_name . '[und][0][locpick][user_longitude]' => 30,
);
$this
->drupalPost(NULL, $form, t('Save settings'));
unset($form);
$this
->assertText(t('Saved ' . self::$field_name . ' configuration.'));
}
}
}