? 854628-1_fix_roles.patch ? libraries/simplepie.inc Index: plugins/FeedsUserProcessor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsUserProcessor.inc,v retrieving revision 1.16 diff -u -p -r1.16 FeedsUserProcessor.inc --- plugins/FeedsUserProcessor.inc 18 Jul 2010 19:35:05 -0000 1.16 +++ plugins/FeedsUserProcessor.inc 18 Jul 2010 19:35:48 -0000 @@ -100,7 +100,7 @@ class FeedsUserProcessor extends FeedsPr // Prepare term object. $target_account = new stdClass(); $target_account->uid = 0; - $target_account->roles = $this->config['roles']; + $target_account->roles = array_filter($this->config['roles']); $target_account->status = $this->config['status']; // Have parent class do the iterating. Index: tests/feeds.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/feeds/tests/feeds.test,v retrieving revision 1.22 diff -u -p -r1.22 feeds.test --- tests/feeds.test 18 Jul 2010 19:22:46 -0000 1.22 +++ tests/feeds.test 18 Jul 2010 19:35:49 -0000 @@ -618,18 +618,32 @@ class FeedsCSVtoUsersTest extends FeedsW ); $this->drupalPost('admin/build/feeds/edit/user_import/settings', $edit, 'Save'); + // Create roles and assign one of them to the users to be imported. + $manager_rid = $this->drupalCreateRole(array('access content'), 'manager'); + $admin_rid = $this->drupalCreateRole(array('access content'), 'administrator'); + $edit = array( + "roles[$manager_rid]" => TRUE, + "roles[$admin_rid]" => FALSE, + ); + $this->setSettings('user_import', 'FeedsUserProcessor', $edit); + // Import CSV file. $this->importFile('user_import', $this->absolutePath() .'/tests/feeds/users.csv'); // Assert result. $this->assertText('Created 4 users.'); - // 1 user has an invalid email address. + // 1 user has an invalid email address, all users should be assigned + // the manager role. $this->assertText('There was 1 user that could not be imported because either their name or their email was empty or not valid. Check import data and mapping settings on User processor.'); $this->drupalGet('admin/user/user'); $this->assertText('Morticia'); $this->assertText('Fester'); $this->assertText('Gomez'); $this->assertText('Pugsley'); + $count = db_result(db_query("SELECT count(*) FROM {users_roles} WHERE rid = %d", $manager_rid)); + $this->assertEqual($count, 4, t('All imported users were assigned the manager role.')); + $count = db_result(db_query("SELECT count(*) FROM {users_roles} WHERE rid = %d", $admin_rid)); + $this->assertEqual($count, 0, t('No imported user was assigned the administrator role.')); // @todo Test status setting, update existing and role settings. }