public function FeedsCSVtoUsersTest::testSha512 in Feeds 7.2
Test if users with sha512 passwords can login after import.
File
- tests/
feeds_processor_user.test, line 839 - Tests for plugins/FeedsUserProcessor.inc.
Class
- FeedsCSVtoUsersTest
- Test aggregating a feed as data records.
Code
public function testSha512() {
// Set to update existing users.
$this
->setSettings('user_import', 'FeedsUserProcessor', array(
'update_existing' => FEEDS_UPDATE_EXISTING,
));
// Replace password mapper.
$this
->removeMappings('user_import', array(
3 => array(
'source' => 'password',
'target' => 'pass',
),
));
$this
->addMappings('user_import', array(
3 => array(
'source' => 'password_sha512',
'target' => 'pass',
'pass_encryption' => 'sha512',
),
));
// Create an account for Gomez, to ensure passwords can also be imported for
// existing users. Give Gomez a password different from the one that gets
// imported to ensure that his password gets updated.
user_save(drupal_anonymous_user(), array(
'name' => 'Gomez',
'mail' => 'gomez@example.com',
'pass' => 'temporary',
'status' => 1,
));
// Import CSV file.
$this
->importFile('user_import', $this
->absolutePath() . '/tests/feeds/users.csv');
// Assert result.
$this
->assertText('Created 2 users');
$this
->assertText('Updated 1 user');
// Try to login as each successful imported user.
$this
->feedsLoginUser('Morticia', 'mort');
$this
->feedsLoginUser('Fester', 'fest');
$this
->feedsLoginUser('Gomez', 'gome');
}