You are here

public function RestrictByIpRoleTests::testUIRoleDeleted in Restrict Login or Role Access by IP Address 7.3

File

./restrict_by_ip.test, line 215

Class

RestrictByIpRoleTests
Test that role restrictions work. Assumes that local testing environment has IP address of 127.0.0.1.

Code

public function testUIRoleDeleted() {
  variable_set('restrict_by_ip_role_' . _restrict_by_ip_hash_role_name($this->role['name']), '127.0.0.0/8');
  $this
    ->drupalLogin($this->regularUser);
  $form = array();
  $this
    ->drupalPost('admin/people/permissions/roles/edit/' . $this->role['id'], $form, t('Delete role'));
  $this
    ->drupalPost(NULL, $form, t('Delete'));
  $this
    ->assertText('The role has been deleted.');

  // If we get the default, we know the variable is deleted.
  $ip = variable_get('restrict_by_ip_role_' . _restrict_by_ip_hash_role_name($this->role['name']), 'ip default');
  $this
    ->assertEqual($ip, 'ip default', 'IP restriction deleted');
}