You are here

public function NagiosCheckTest::testElysiaCronCheck in Nagios Monitoring 8

File

tests/src/Kernel/NagiosCheckTest.php, line 33

Class

NagiosCheckTest
Tests the functionality to monitor cron.

Namespace

Drupal\Tests\nagios\Kernel

Code

public function testElysiaCronCheck() {
  $conn = Database::getConnection();
  $conn
    ->query('CREATE TABLE {elysia_cron} (last_aborted int(11), name varchar(8), last_abort_function varchar(8))');
  $status = nagios_check_elysia_cron()['data']['status'];
  self::assertEquals(NAGIOS_STATUS_OK, $status);
  $conn
    ->query("INSERT INTO {elysia_cron} VALUES (1, 'toad', 'toadcron')");
  $status = nagios_check_elysia_cron()['data']['status'];
  self::assertEquals(NAGIOS_STATUS_CRITICAL, $status);
  $conn
    ->query('DROP TABLE {elysia_cron}');
}