function BanIpTest::getIpBans

Same name in other branches
  1. 10 core/modules/ban/tests/src/Kernel/BanIpTest.php \Drupal\Tests\ban\Kernel\BanIpTest::getIpBans()

Gets the IP bans.

1 call to BanIpTest::getIpBans()
BanIpTest::testBanIp in core/modules/ban/tests/src/Kernel/BanIpTest.php
Test banning IPs.

File

core/modules/ban/tests/src/Kernel/BanIpTest.php, line 58

Class

BanIpTest
@group ban

Namespace

Drupal\Tests\ban\Kernel

Code

protected function getIpBans(string $ip) : array {
    $connection = $this->container
        ->get(Connection::class);
    $query = $connection->select('ban_ip', 'bip');
    $query->fields('bip', [
        'iid',
    ]);
    $query->condition('bip.ip', $ip);
    return $query->execute()
        ->fetchAll();
}

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