public function UiTest::testAdminDeleteUserSubmit in Restrict Login or Role Access by IP Address 8.4
File
- src/
Tests/ UiTest.php, line 138
Class
- UiTest
- Test admin interfaces.
Namespace
Drupal\restrict_by_ip\TestsCode
public function testAdminDeleteUserSubmit() {
// First add a user.
$user = $this
->drupalCreateUser();
$form = [];
$form['name'] = $user
->label() . ' (' . $user
->id() . ')';
$form['restriction'] = $this->currentIPCIDR;
$this
->drupalPostForm('admin/config/people/restrict_by_ip/login/user', $form, t('Save configuration'));
$this
->assertText('The configuration options have been saved.');
$this
->assertFieldByName('restrict_by_ip_user_' . $user
->id(), $form['restriction']);
// Then delete it's IP.
$form = [];
$form['restrict_by_ip_user_' . $user
->id()] = '';
$this
->drupalPostForm('admin/config/people/restrict_by_ip/login/user', $form, t('Save configuration'));
$this
->assertText('The configuration options have been saved.');
$this
->assertNoFieldByName('restrict_by_ip_user_' . $user
->id(), NULL);
}