You are here

public function IpFieldValidationRuleTest::ipInvalidProvider in Field Validation 8

Data provider for invalid ip by version.

Return value

array Returns the dataset.

File

tests/src/Kernel/Plugin/FieldValidationRule/IpFieldValidationRuleTest.php, line 194

Class

IpFieldValidationRuleTest
Tests IpFieldValidationRule.

Namespace

Drupal\Tests\field_validation\Kernel\Plugin\FieldValidationRule

Code

public function ipInvalidProvider() {
  return [
    'ipv4-1' => [
      '4',
      '1200:0000:AB00:1234:0000:2552:7777:1313',
    ],
    'ipv6-1' => [
      '6',
      '192.168.1.1',
    ],
    'ipv6-2' => [
      '6',
      '[2001:db8:0:1]:80',
    ],
    'ipv6-3' => [
      '6',
      'http://[2001:db8:0:1]:80',
    ],
    'ipv4-no-priv-1' => [
      '4_no_priv',
      '192.168.0.0',
    ],
    'ipv4-no-priv-2' => [
      '4_no_priv',
      '172.16.0.0',
    ],
    'ipv4-no-priv-3' => [
      '4_no_priv',
      '10.0.0.0',
    ],
    'ipv4-no-priv-4' => [
      '4_no_priv',
      '21DA:D3:0:2F3B:2AA:FF:FE28:9C5A',
    ],
    'ipv6-no-priv-1' => [
      '6_no_priv',
      'fd57:5e8d:962e:5ee5::',
    ],
    'ipv6-no-priv-2' => [
      '6_no_priv',
      '192.168.1.1',
    ],
    'all-1-no-private' => [
      'all_no_priv',
      '192.168.0.0',
    ],
    'all-2-no-private' => [
      'all_no_priv',
      'fd57:5e8d:962e:5ee5::',
    ],
    'all-1-no-reserved' => [
      'all_no_res',
      '::1',
    ],
    'all-2-no-reserved' => [
      'all_no_res',
      '169.254.255.255',
    ],
    'all-1-public' => [
      'all_public',
      '192.168.0.0',
    ],
    'all-2-public' => [
      'all_public',
      'fd57:5e8d:962e:5ee5::',
    ],
    'ipv4-no-reserved' => [
      '4_no_res',
      '169.254.255.255',
    ],
    'ipv6-no-reserved' => [
      '6_no_res',
      '::1',
    ],
    'ipv4-public' => [
      '4_public',
      '192.168.0.0',
    ],
    'ipv6-public' => [
      '6_public',
      'fd57:5e8d:962e:5ee5::',
    ],
  ];
}