Index: CHANGELOG.txt =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/autoassignrole/CHANGELOG.txt,v retrieving revision 1.6 diff -u -p -r1.6 CHANGELOG.txt --- CHANGELOG.txt 19 Oct 2010 04:23:54 -0000 1.6 +++ CHANGELOG.txt 27 Oct 2010 22:34:49 -0000 @@ -2,10 +2,19 @@ autoassignrole 7.0, xxxx-xx-xx (development version) ------------------------ -- [#937468] Use Case - Administrator enables/disables automatic assignment +- [#937468] Use Case - Administrator enables/disables automatic assignment. - [#937666] Use Case - Administrator enables/disables automatic assignment of +<<<<<<< CHANGELOG.txt + admin created accounts. +- [#937678] Use Case - Administrator sets roles for automatic assignment. +- [#944880] Administrator toggles allowing user to select role. +- [#944922] Administrator sets roles that will be visible to the end user. +- [#944944] Administrator toggles letting user select multiple roles. +- [#944974] Administrator sets the selection method of roles for an end user. +======= admin created accounts - [#937678] Use Case - Administrator sets roles for automatic assignment - [#944880] Administrator toggles allowing user to select role - [#944922] Administrator sets roles that will be visible to the end user - [#944944] Administrator toggles letting user select multiple roles +>>>>>>> 1.6 Index: autoassignrole.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/autoassignrole/autoassignrole.admin.inc,v retrieving revision 1.5 diff -u -p -r1.5 autoassignrole.admin.inc --- autoassignrole.admin.inc 19 Oct 2010 04:23:54 -0000 1.5 +++ autoassignrole.admin.inc 27 Oct 2010 22:34:49 -0000 @@ -66,7 +66,7 @@ function autoassignrole_auto_settings() '#type' => 'checkboxes', '#title' => t('Roles'), '#default_value' => variable_get('autoassignrole_auto_roles', array()), - '#description' => t('Check the specific Roles the user will automatically + '#description' => t('Check the specific roles the user will automatically be assigned to when created by an administrator or through the new user registration process. The Authenticated User role is automatically assigned by Drupal core and can not be edited.'), @@ -109,11 +109,19 @@ function autoassignrole_user_settings() $form['autoassignrole_user_multiple'] = array( '#type' => 'radios', - '#title' => t('User Role Selection'), + '#title' => t('User role selection'), '#default_value' => variable_get('autoassignrole_user_multiple', 0), '#description' => t('Should the end user be allowed to choose a single role or can they choose multiple roles?'), '#options' => array(0 => t('Single Role'), 1 => t('Multiple Roles')), ); + $form['autoassignrole_user_selection'] = array( + '#type' => 'radios', + '#title' => t('Selection method'), + '#default_value' => variable_get('autoassignrole_user_selection', 0), + '#description' => t('The type of form elements the end user will be presented with.'), + '#options' => array(0 => t('Radio Buttons'), 1 => t('Selection Box'), 2 => t('Check Boxes')), + ); + return system_settings_form($form); } Index: autoassignrole.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/autoassignrole/autoassignrole.test,v retrieving revision 1.6 diff -u -p -r1.6 autoassignrole.test --- autoassignrole.test 19 Oct 2010 04:23:54 -0000 1.6 +++ autoassignrole.test 27 Oct 2010 22:34:49 -0000 @@ -242,10 +242,11 @@ class AutoassignroleAdminSettingsTestCas $this->assertEqual(TRUE, array_key_exists($rid, $roles), 'Verifying that role (rid:' . $rid . ') was activated.'); } } - /** - * Test admin setting functionality for autoassignrole_user_multiple. - * @see http://drupal.org/node/944944 - */ + +/** + * Test admin setting functionality for autoassignrole_user_multiple. + * @see http://drupal.org/node/944944 + */ function testAdminUserMultipleSettings() { // Create a new user who can access the administration settings $this->drupalLogin($this->admin_user); @@ -287,4 +288,65 @@ class AutoassignroleAdminSettingsTestCas 'autoassignrole_user_multiple has been disabled' ); } + +/** + * Test admin setting functionality for autoassignrole_user_selection. + * @see http://drupal.org/node/944974 + */ + function testAdminUserSelectionSettings() { + // Create a new user who can access the administration settings + $this->drupalLogin($this->admin_user); + + // Check that the user can see the admin settings page. + $this->drupalGet('admin/config/autoassignrole/user'); + $this->assertField( + 'autoassignrole_user_selection', + 'The autoassignrole_user_selection field is accessible.' + ); + + // Set autoassignrole_user_selection to radio inputs. + $edit['autoassignrole_user_selection'] = 0; + $this->drupalPost( + 'admin/config/autoassignrole/user', + $edit, + t('Save configuration') + ); + + // Verify autoassignrole_user_selection has set to radio + $this->assertEqual( + variable_get('autoassignrole_user_selection', -1), + 0, + 'autoassignrole_user_selection has been set to radio' + ); + + // Set autoassignrole_user_selection to select box. + $edit['autoassignrole_user_selection'] = 1; + $this->drupalPost( + 'admin/config/autoassignrole/user', + $edit, + t('Save configuration') + ); + + // Verify autoassignrole_user_selection has been set to select box + $this->assertEqual( + variable_get('autoassignrole_user_selection', -1), + 1, + 'autoassignrole_user_selection has been set to select box' + ); + + // Set autoassignrole_user_selection to check box. + $edit['autoassignrole_user_selection'] = 2; + $this->drupalPost( + 'admin/config/autoassignrole/user', + $edit, + t('Save configuration') + ); + + // Verify autoassignrole_user_selection has been set to check box + $this->assertEqual( + variable_get('autoassignrole_user_selection', -1), + 2, + 'autoassignrole_user_selection has been set to check box' + ); + } }