You are here

public function BlockedIpsExpireHelpers::getTestOneByIp in Blocked IPs Expire 7

Tests that the helper function to get data about an IP address works.

@covers _blocked_ips_expire_get_one_by_ip()

File

tests/blocked_ips_expire.helpers.test, line 288
Contains \BlockedIpsExpireHelpers.

Class

BlockedIpsExpireHelpers
Tests that helper functions are operating correctly.

Code

public function getTestOneByIp() {

  // Add an IP address.
  $iid = _blocked_ips_expire_add_ip($this->anyOldIp, $this->anyOldDate);

  // Get the same IP address back.
  $ip_info = _blocked_ips_expire_get_one_by_ip($this->anyOldIp);

  // Validate that it's fields are what we expect.
  $this
    ->assertEqual($iid, $ip_info->iid, 'IID of retrieved object matches the one that was returned when we saved it.');
  $this
    ->assertEqual($this->anyOldIp, $ip_info->ip, 'IP of retrieved object matches the one passed into the save function.');
  $this
    ->assertEqual($this->anyOldDate, $ip_info->expiry_date, 'Expiry time of retrieved object matches the one passed into the save function.');
}