diff --git a/core/modules/block/block.test b/core/modules/block/block.test index e6b2e42..0e17a7c 100644 --- a/core/modules/block/block.test +++ b/core/modules/block/block.test @@ -111,7 +111,7 @@ class BlockTestCase extends WebTestBase { // Set visibility only for authenticated users, to verify delete functionality. $edit = array(); - $edit['roles[2]'] = TRUE; + $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = TRUE; $this->drupalPost('admin/structure/block/manage/block/' . $bid . '/configure', $edit, t('Save block')); // Delete the created custom block & verify that it's been deleted and no longer appearing on the page. diff --git a/core/modules/book/book.test b/core/modules/book/book.test index 00995cb..e55fadb 100644 --- a/core/modules/book/book.test +++ b/core/modules/book/book.test @@ -282,8 +282,8 @@ class BookTestCase extends WebTestBase { // Give anonymous users the permission 'node test view'. $edit = array(); - $edit['1[node test view]'] = TRUE; - $this->drupalPost('admin/people/permissions/1', $edit, t('Save permissions')); + $edit[DRUPAL_ANONYMOUS_RID . '[node test view]'] = TRUE; + $this->drupalPost('admin/people/permissions/' . DRUPAL_ANONYMOUS_RID, $edit, t('Save permissions')); $this->assertText(t('The changes have been saved.'), t("Permission 'node test view' successfully assigned to anonymous users.")); // Test correct display of the block. @@ -318,8 +318,8 @@ class BookTestCase extends WebTestBase { // Give anonymous users the permission 'node test view'. $edit = array(); - $edit['1[node test view]'] = TRUE; - $this->drupalPost('admin/people/permissions/1', $edit, t('Save permissions')); + $edit[DRUPAL_ANONYMOUS_RID . '[node test view]'] = TRUE; + $this->drupalPost('admin/people/permissions/' . DRUPAL_ANONYMOUS_RID, $edit, t('Save permissions')); $this->assertText(t('The changes have been saved.'), t('Permission \'node test view\' successfully assigned to anonymous users.')); // Create a book. diff --git a/core/modules/file/tests/file.test b/core/modules/file/tests/file.test index a826c14..66f20ca 100644 --- a/core/modules/file/tests/file.test +++ b/core/modules/file/tests/file.test @@ -556,7 +556,7 @@ class FileFieldWidgetTestCase extends FileFieldTestCase { // Remove access comments permission from anon user. $edit = array( - '1[access comments]' => FALSE, + DRUPAL_ANONYMOUS_RID . '[access comments]' => FALSE, ); $this->drupalPost('admin/people/permissions', $edit, t('Save permissions')); diff --git a/core/modules/filter/filter.test b/core/modules/filter/filter.test index 923a047..7b043ae 100644 --- a/core/modules/filter/filter.test +++ b/core/modules/filter/filter.test @@ -319,7 +319,7 @@ class FilterAdminTestCase extends WebTestBase { $edit = array(); $edit['format'] = drupal_strtolower($this->randomName()); $edit['name'] = $this->randomName(); - $edit['roles[2]'] = 1; + $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1; $edit['filters[' . $second_filter . '][status]'] = TRUE; $edit['filters[' . $first_filter . '][status]'] = TRUE; $this->drupalPost('admin/config/content/formats/add', $edit, t('Save configuration')); @@ -329,7 +329,7 @@ class FilterAdminTestCase extends WebTestBase { $format = filter_format_load($edit['format']); $this->assertNotNull($format, t('Format found in database.')); - $this->assertFieldByName('roles[2]', '', t('Role found.')); + $this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', '', t('Role found.')); $this->assertFieldByName('filters[' . $second_filter . '][status]', '', t('Line break filter found.')); $this->assertFieldByName('filters[' . $first_filter . '][status]', '', t('Url filter found.')); @@ -340,8 +340,8 @@ class FilterAdminTestCase extends WebTestBase { // Allow authenticated users on full HTML. $format = filter_format_load($full); $edit = array(); - $edit['roles[1]'] = 0; - $edit['roles[2]'] = 1; + $edit['roles[' . DRUPAL_ANONYMOUS_RID . ']'] = 0; + $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1; $this->drupalPost('admin/config/content/formats/' . $full, $edit, t('Save configuration')); $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), t('Full HTML format successfully updated.')); @@ -391,10 +391,10 @@ class FilterAdminTestCase extends WebTestBase { // Full HTML. $edit = array(); - $edit['roles[2]'] = FALSE; + $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = FALSE; $this->drupalPost('admin/config/content/formats/' . $full, $edit, t('Save configuration')); $this->assertRaw(t('The text format %format has been updated.', array('%format' => $format->name)), t('Full HTML format successfully reverted.')); - $this->assertFieldByName('roles[2]', $edit['roles[2]'], t('Changes reverted.')); + $this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'], t('Changes reverted.')); // Filter order. $edit = array(); @@ -1829,7 +1831,7 @@ class FilterHooksTestCase extends WebTestBase { $edit = array(); $edit['format'] = drupal_strtolower($this->randomName()); $edit['name'] = $name; - $edit['roles[1]'] = 1; + $edit['roles[' . DRUPAL_ANONYMOUS_RID . ']'] = 1; $this->drupalPost('admin/config/content/formats/add', $edit, t('Save configuration')); $this->assertRaw(t('Added text format %format.', array('%format' => $name)), t('New format created.')); $this->assertText('hook_filter_format_insert invoked.', t('hook_filter_format_insert was invoked.')); @@ -1838,7 +1840,7 @@ class FilterHooksTestCase extends WebTestBase { // Update text format. $edit = array(); - $edit['roles[2]'] = 1; + $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 1; $this->drupalPost('admin/config/content/formats/' . $format_id, $edit, t('Save configuration')); $this->assertRaw(t('The text format %format has been updated.', array('%format' => $name)), t('Format successfully updated.')); $this->assertText('hook_filter_format_update invoked.', t('hook_filter_format_update() was invoked.')); diff --git a/core/modules/php/php.test b/core/modules/php/php.test index 7f86ecc..980fb7b 100644 --- a/core/modules/php/php.test +++ b/core/modules/php/php.test @@ -38,8 +38,8 @@ class PHPTestCase extends WebTestBase { // Verify that anonymous and authenticated user roles do not have access. $this->drupalGet('admin/config/content/formats/' . $php_format_id); - $this->assertFieldByName('roles[1]', FALSE, t('Anonymous users do not have access to PHP code format.')); - $this->assertFieldByName('roles[2]', FALSE, t('Authenticated users do not have access to PHP code format.')); + $this->assertFieldByName('roles[' . DRUPAL_ANONYMOUS_RID . ']', FALSE, t('Anonymous users do not have access to PHP code format.')); + $this->assertFieldByName('roles[' . DRUPAL_AUTHENTICATED_RID . ']', FALSE, t('Authenticated users do not have access to PHP code format.')); } /** diff --git a/core/modules/user/user.test b/core/modules/user/user.test index 57a3713..d6f71ec 100644 --- a/core/modules/user/user.test +++ b/core/modules/user/user.test @@ -2259,9 +2261,13 @@ class UserRolesAssignmentTestCase extends WebTestBase { /** * Check role on user object. * - * @param object $account User. - * @param integer $rid Role id. - * @param bool $is_assigned True if the role should present on the account. + * @param object $account + * The user account to check. + * @param string $rid + * The role ID to search for. + * @param bool $is_assigned + * (optional) Whether to assert that $rid exists (TRUE) or not (FALSE). + * Defaults to TRUE. */ private function userLoadAndCheckRoleAssigned($account, $rid, $is_assigned = TRUE) { $account = user_load($account->uid, TRUE);