You are here

public function BlockedIpsExpireBulkAssign::testBulkAssignMessageOnStatusReport in Blocked IPs Expire 7

Tests that the status report shows when IPs don't have expiry dates.

File

tests/blocked_ips_expire.bulk_assign.test, line 80
Contains \BlockedIpsExpireBulkAssign.

Class

BlockedIpsExpireBulkAssign
Tests that IPs without expiry dates can be fixed.

Code

public function testBulkAssignMessageOnStatusReport() {

  // Create an admin and log in.
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
    'access site reports',
  ));
  $this
    ->drupalLogin($admin_user);

  // Get the status report and test there is no status report row.
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertNoText(t("to assign expiry dates to blocked IP addresses that don't have them."), 'Status report does not show a message when all IP addresses have expiry dates.');

  // Add an IP address without an expiry date.
  BlockedIpsExpireBulkAssign::addIpWithoutExpiryTime($this->ipWithoutExpiry);

  // Get the status report and test there is now a status report row.
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->assertText(t("to assign expiry dates to blocked IP addresses that don't have them."), 'Status report correctly reports if there are IP addresses without expiry dates.');
}