public function UIFTestCaseCore::testUIFImportCore in User Import Framework 7
File
- ./
uif.test, line 90 - UIF test code.
Class
- UIFTestCaseCore
- Test import with core user fields.
Code
public function testUIFImportCore() {
$this
->drupalLogin($this->import_user);
$edit = array();
$edit['files[user_upload]'] = DRUPAL_ROOT . '/' . drupal_get_path('module', 'uif') . '/test_data/test_core_fields_1.csv';
$this
->drupalPost('admin/people/uif', $edit, t('Next'));
$this
->assertText(t('Preview these records and when ready to import click Import users', array()));
$this
->assertText(t('fred@example.com', array()));
$this
->assertText(t('(create)', array()));
$this
->assertText(t('mail', array()));
$this
->assertText(t('name', array()));
$this
->assertText(t('pass', array()));
$this
->assertText(t('created', array()));
$this
->assertText(t('access', array()));
$this
->assertText(t('login', array()));
$this
->assertText(t('status', array()));
$this
->assertText(t('timezone', array()));
$this
->assertText(t('language', array()));
$this
->drupalPost(NULL, array(), t('Import users'));
$this
->assertText(t('User import complete', array()));
$this
->drupalLogin($this->admin_user);
$edit = array(
'langcode' => 'es',
);
$this
->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
$edit = array(
'configurable_timezones' => 1,
);
$this
->drupalPost('admin/config/regional/settings', $edit, t('Save configuration'));
// Retrieve imported user
$name = 'freddie';
$account = user_load_by_name($name);
$this
->assertTrue($account != NULL, t('User @name was loaded', array(
'@name' => $name,
)));
$account->pass_raw = '123';
$this
->drupalLogin($account);
$this
->drupalGet('user/' . $account->uid . '/edit');
$this
->assertRaw('value="es" checked="checked"');
$this
->assertRaw('value="Europe/Madrid" selected="selected"');
$this
->assertRaw('name="mail" value="fred@example.com"');
}