public function BlockedIpsExpireHelpers::testDeleteIp in Blocked IPs Expire 7
Tests that the helper function to delete a single IP address works.
File
- tests/
blocked_ips_expire.helpers.test, line 310 - Contains \BlockedIpsExpireHelpers.
Class
- BlockedIpsExpireHelpers
- Tests that helper functions are operating correctly.
Code
public function testDeleteIp() {
// Add the IP to the database.
$iid = _blocked_ips_expire_add_ip($this->anyOldIp, $this->anyOldDate);
// Test that the IP address is in the database before deleting.
$num_times_in_db = BlockedIpsExpireHelpers::numberTimesIpInDatabase($this->anyOldIp);
$this
->assertTrue($num_times_in_db > 0, 'Test IP in database before deleting.');
// Test deleting the IP.
_blocked_ips_expire_delete_ip($iid);
// Test that the IP address is no longer in the database.
$num_times_in_db = BlockedIpsExpireHelpers::numberTimesIpInDatabase($this->anyOldIp);
$this
->assertFalse($num_times_in_db > 0, 'Test IP has been deleted.');
}