You are here

public function BlockedIpsExpireHelpers::testGetOneByIid in Blocked IPs Expire 7

Tests that the helper function to get a single IP address works.

@covers _blocked_ips_expire_get_one()

File

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

Class

BlockedIpsExpireHelpers
Tests that helper functions are operating correctly.

Code

public function testGetOneByIid() {

  // 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($iid);

  // 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.');
}