You are here

public function UIFTestCaseSimple::testUIFImportSuccessful in User Import Framework 7

File

./uif.test, line 30
UIF test code.

Class

UIFTestCaseSimple
Simple import testing.

Code

public function testUIFImportSuccessful() {
  $this
    ->drupalLogin($this->import_user);
  $edit = array();
  $edit['files[user_upload]'] = DRUPAL_ROOT . '/' . drupal_get_path('module', 'uif') . '/test_data/test_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('jane@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('mail substituted for deprecated label email');
  $this
    ->assertText('name substituted for deprecated label username');
  $this
    ->assertText('pass substituted for deprecated label password');
  $this
    ->drupalPost(NULL, array(), t('Import users'));
  $this
    ->assertText(t('User import complete', array()));
  $this
    ->assertText(t('One user was created', array()));

  // Retrieve imported user
  $name = 'jane';
  $account = user_load_by_name($name);
  $this
    ->assertTrue($account != NULL, t('User @name was loaded', array(
    '@name' => $name,
  )));
  $account->pass_raw = 'zebra';
  $this
    ->drupalLogin($account);
}