You are here

public function UIFPlusImageFieldsTestCase::testUIFPlusUserPictureFieldImport in User Import Framework Plus 7

Test import if user pictures

File

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

Class

UIFPlusImageFieldsTestCase

Code

public function testUIFPlusUserPictureFieldImport() {

  // We need an admin user that can import users and view any user's account page
  $this
    ->drupalLogin($this->admin_user);
  variable_set('uif_value_delimiter', '_:_');

  // import user
  $edit = array();
  $edit['files[user_upload]'] = DRUPAL_ROOT . '/' . drupal_get_path('module', 'uif_plus') . '/data/test_images_1.csv';
  $this
    ->drupalPost('admin/people/uif', $edit, t('Next'));
  $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 and log them in
  $accounts = user_load_multiple(array(), array(
    'name' => 'flintstone',
    'mail' => 'flintstone@bedrock.com',
  ));
  $new_user = reset($accounts);

  // Check image on new user's profile page.
  $this
    ->drupalGet('user/' . $new_user->uid);
  $this
    ->assertRaw(file_uri_target($new_user->picture->uri), t("Uploaded image is displayed in user's profile page"));
}