function BanAdminTest::providerIpValidation

Same name and namespace in other branches
  1. 11.x core/modules/ban/tests/src/Unit/BanAdminTest.php \Drupal\Tests\ban\Unit\BanAdminTest::providerIpValidation()

Data provider for testIpValidation().

File

core/modules/ban/tests/src/Unit/BanAdminTest.php, line 105

Class

BanAdminTest
Tests the BanAdmin form.

Namespace

Drupal\Tests\ban\Unit

Code

public static function providerIpValidation() : array {
  return [
    'valid ip' => [
      '1.2.3.3',
      FALSE,
      NULL,
    ],
    'already blocked' => [
      '1.2.3.3',
      TRUE,
      'This IP address is already banned.',
    ],
    'reserved ip' => [
      '255.255.255.255',
      FALSE,
      'Enter a valid IP address.',
    ],
    'fqdn' => [
      'test.example.com',
      FALSE,
      'Enter a valid IP address.',
    ],
    'empty' => [
      '',
      FALSE,
      'Enter a valid IP address.',
    ],
    'client ip' => [
      '127.0.0.1',
      FALSE,
      'You may not ban your own IP address.',
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.