You are here

public function UIFPlusProfileFieldsTestCase::testUIFPlusProfile2FieldImport in User Import Framework Plus 7

Test import of profile2 fields

File

./uif_plus.test, line 169
Test cases for User Import Framework Plus module

Class

UIFPlusProfileFieldsTestCase

Code

public function testUIFPlusProfile2FieldImport() {
  $this
    ->drupalLogin($this->import_user);

  // import user
  variable_set('uif_value_delimiter', '_:_');
  $edit = array();
  $edit['files[user_upload]'] = DRUPAL_ROOT . '/' . drupal_get_path('module', 'uif_plus') . '/data/test_profile2_1.csv';
  $this
    ->drupalPost('admin/people/uif', $edit, t('Next'));

  //$this->assertText(t('Unknown column profile_fullname in the import file. Data in this column will be ignored.', array()));
  $this
    ->drupalPost(NULL, array(), t('Import users'));
  $this
    ->assertText(t('User import complete', array()));
  $this
    ->assertText(t('One user was created', array()));

  // load imported user
  $accounts = user_load_multiple(array(), array(
    'name' => 'flintstone',
    'mail' => 'flintstone@bedrock.com',
  ));
  $new_user = reset($accounts);

  // load and check
  $this
    ->assertEqual(profile2_load_by_user($new_user, 'main')->profile_fullname[LANGUAGE_NONE][0]['value'], 'Fred Flintstone', 'Profile2 field imported successfully');
}