You are here

public function UiTest::testUserEditValidation in Restrict Login or Role Access by IP Address 8.4

File

src/Tests/UiTest.php, line 54

Class

UiTest
Test admin interfaces.

Namespace

Drupal\restrict_by_ip\Tests

Code

public function testUserEditValidation() {
  $user = $this
    ->drupalCreateUser();
  $this
    ->drupalGet('user/' . $user
    ->id() . '/edit');
  $this
    ->assertFieldByName('restrict_by_ip_address', '');
  $form = [];
  $form['restrict_by_ip_address'] = 'not_an_ip';
  $this
    ->drupalPostForm('user/' . $user
    ->id() . '/edit', $form, t('Save'));
  $this
    ->assertText('IP address must be in CIDR notation.');
  $this
    ->assertNoText('The changes have been saved.');
}