You are here

public function RoleTest::testUIRoleDeleted in Restrict Login or Role Access by IP Address 8.4

File

src/Tests/RoleTest.php, line 66

Class

RoleTest
Tests roles are restricted to certain IP address range(s).

Namespace

Drupal\restrict_by_ip\Tests

Code

public function testUIRoleDeleted() {
  $this->conf
    ->set('role.' . $this->role
    ->id(), $this->currentIPCIDR)
    ->save();
  $this
    ->drupalLogin($this->regularUser);
  $edit = [];
  $this
    ->drupalPostForm('admin/people/roles/manage/' . $this->role
    ->id() . '/delete', $edit, t('Delete'));
  $this
    ->assertText('The role ' . $this->role
    ->label() . ' has been deleted.');

  // If we get the default, we know the variable is deleted.
  $updatedConf = $this
    ->config('restrict_by_ip.settings');
  $ip = $updatedConf
    ->get('role.' . $this->role
    ->id());
  $this
    ->assertNull($ip, 'IP restriction deleted');
}