public function FeedsCSVtoUsersTest::testMailAlreadyTaken in Feeds 7.2
Tests importing an user which mail address is already taken.
File
- tests/
feeds_processor_user.test, line 1035 - Tests for plugins/FeedsUserProcessor.inc.
Class
- FeedsCSVtoUsersTest
- Test aggregating a feed as data records.
Code
public function testMailAlreadyTaken() {
// Do not mark mail address as unique.
$path = 'admin/structure/feeds/user_import/mapping';
$this
->drupalPostAJAX($path, array(), 'mapping_settings_edit_1');
$edit = array(
"config[1][settings][unique]" => FALSE,
);
$this
->drupalPostAJAX(NULL, $edit, 'mapping_settings_update_1');
$this
->drupalPost(NULL, array(), t('Save'));
// Create an account.
user_save(drupal_anonymous_user(), array(
'name' => 'Morticia2',
'mail' => 'morticia@example.com',
'pass' => 'mort',
'status' => 1,
));
// Import a file that contains a mail address that is already taken.
$this
->importFile('user_import', $this
->absolutePath() . '/tests/feeds/user_validation/username-already-taken.csv');
$this
->assertText('Failed importing 1 user');
$this
->assertText("The e-mail address 'morticia@example.com' is already taken.");
}