You are here

public function RestrictIpServiceTest::settingsIpAddressesDataProvider in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Service/RestrictIpServiceTest.php \Drupal\Tests\restrict_ip\Unit\Service\RestrictIpServiceTest::settingsIpAddressesDataProvider()
  2. 3.x tests/src/Unit/Service/RestrictIpServiceTest.php \Drupal\Tests\restrict_ip\Unit\Service\RestrictIpServiceTest::settingsIpAddressesDataProvider()

* Data provider for testSettingsIpAddresses()

File

tests/src/Unit/Service/RestrictIpServiceTest.php, line 299

Class

RestrictIpServiceTest
@coversDefaultClass \Drupal\restrict_ip\Service\RestrictIpService @group restrict_ip

Namespace

Drupal\Tests\restrict_ip\Unit\Service

Code

public function settingsIpAddressesDataProvider() {
  return [
    [
      '::1',
      $this
        ->getConfigFactory([
        'enable' => TRUE,
        'white_black_list' => 0,
        'ip_whitelist' => [
          '::1',
        ],
      ]),
      FALSE,
      'User is not blocked when IP address has been whitelisted in settings.php',
    ],
    [
      '::1',
      $this
        ->getConfigFactory([
        'enable' => TRUE,
        'white_black_list' => 0,
        'ip_whitelist' => [
          '::2',
        ],
      ]),
      TRUE,
      'User is blocked when IP address has not been whitelisted through settings.php',
    ],
  ];
}