function UserImportNodeprofile::nodeprofileConfiguration in User Import 5
Same name and namespace in other branches
- 8 tests/user_import_nodeprofile.test \UserImportNodeprofile::nodeprofileConfiguration()
* Configure modules
1 call to UserImportNodeprofile::nodeprofileConfiguration()
- UserImportNodeprofile::testCreateImport in tests/
user_import_nodeprofile.test - * User with right permissions creates import (with new settings) * - test import of user data into Nodeprofile module
File
- tests/
user_import_nodeprofile.test, line 56
Class
- UserImportNodeprofile
- Test import of user data into Profile module
Code
function nodeprofileConfiguration() {
$this->admin_user = $this
->drupalCreateUserRolePerm(array(
'administer users',
'access administration pages',
'administer access control',
'administer site configuration',
'administer content types',
'administer taxonomy',
));
$this
->drupalLoginUser($this->admin_user);
// create Identity content type
$edit = array(
'name' => 'Identity',
'type' => 'identity',
'title_label' => 'Title',
'body_label' => NULL,
'node_options[promote]' => 0,
'nodefamily_max' => 1,
'nodeprofile' => 1,
);
$this
->drupalPostRequest('admin/content/types/add', $edit, t('Save content type'));
// create First Name field
$edit = array(
'label' => 'first_name',
'field_widget_type' => 'text-text',
);
$this
->drupalPostRequest('admin/content/types/identity/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'First Name',
'required' => 1,
);
$this
->drupalPostRequest('admin/content/types/identity/fields/field_first_name', $edit, t('Save field settings'));
// create Last Name field
$edit = array(
'label' => 'last_name',
'field_widget_type' => 'text-text',
);
$this
->drupalPostRequest('admin/content/types/identity/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'Last Name',
'required' => 1,
);
$this
->drupalPostRequest('admin/content/types/identity/fields/field_last_name', $edit, t('Save field settings'));
// create Biography content type
$edit = array(
'name' => 'Biography',
'type' => 'biography',
'title_label' => 'Title',
'body_label' => NULL,
'node_options[promote]' => 0,
'nodefamily_max' => 1,
'nodeprofile' => 1,
);
$this
->drupalPostRequest('admin/content/types/add', $edit, t('Save content type'));
// create CV field
$edit = array(
'label' => 'cv',
'field_widget_type' => 'text-text',
);
$this
->drupalPostRequest('admin/content/types/biography/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'CV',
'required' => 1,
'rows' => 5,
);
$this
->drupalPostRequest('admin/content/types/biography/fields/field_cv', $edit, t('Save field settings'));
// create Interests Vocabulary - TO DO
$edit = array(
'name' => 'Interests',
'nodes[biography]' => 'biography',
'tags' => 1,
);
$this
->drupalPostRequest('admin/content/taxonomy/add/vocabulary', $edit, t('Submit'));
$vocabularies = taxonomy_get_vocabularies('biography');
foreach ($vocabularies as $vocabulary) {
$this->vocabulary_id = $vocabulary->vid;
}
// create Blog field (URL)
$edit = array(
'label' => 'blog',
'field_widget_type' => 'link-link',
);
$this
->drupalPostRequest('admin/content/types/biography/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'Blog',
);
$this
->drupalPostRequest('admin/content/types/biography/fields/field_blog', $edit, t('Save field settings'));
// create Birthday field (date)
$edit = array(
'label' => 'birthday',
'field_widget_type' => 'datestamp-date_text',
);
$this
->drupalPostRequest('admin/content/types/biography/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'Birthday',
);
$this
->drupalPostRequest('admin/content/types/biography/fields/field_birthday', $edit, t('Save field settings'));
// create Contact Details contact type
$edit = array(
'name' => 'Contact Details',
'type' => 'contact_details',
'title_label' => 'Title',
'body_label' => NULL,
'node_options[promote]' => 0,
'nodefamily_max' => 1,
'nodeprofile' => 1,
);
$this
->drupalPostRequest('admin/content/types/add', $edit, t('Save content type'));
// create Can Be Contacted field
$edit = array(
'label' => 'can_be_contacted',
'field_widget_type' => 'number_integer-options_onoff',
);
$this
->drupalPostRequest('admin/content/types/contact-details/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'Can Be Contacted',
'allowed_values' => "0\n\t\t1|Can be contacted",
);
$this
->drupalPostRequest('admin/content/types/contact-details/fields/field_can_be_contacted', $edit, t('Save field settings'));
// create Contact Preference field
$edit = array(
'label' => 'contact_preference',
'field_widget_type' => 'text-options_select',
);
$this
->drupalPostRequest('admin/content/types/contact-details/add_field', $edit, t('Create field'));
$edit = array(
'label' => 'Contact Preference',
'allowed_values' => 'email|email
telephone|telephone
post|post',
);
$this
->drupalPostRequest('admin/content/types/contact-details/fields/field_contact_preference', $edit, t('Save field settings'));
// set access perm for authenticated users to creade profile nodes
$edit = array(
'2[create identity content]' => 'create identity content',
'2[create biography content]' => 'create biography content',
'2[create contact_details content]' => 'create contact_details content',
);
$this
->drupalPostRequest('admin/user/access', $edit, t('Save permissions'));
}