You are here

public function WatchdogCheckTest::testWithLevelWarning in Nagios Monitoring 8

File

tests/src/Kernel/WatchdogCheckTest.php, line 54

Class

WatchdogCheckTest
Tests the functionality to report dblog/watchdog entries.

Namespace

Drupal\Tests\nagios\Kernel

Code

public function testWithLevelWarning() {
  $this
    ->getLogger('test')
    ->info('info');
  $this
    ->assertAllGreen();
  $this
    ->getLogger('test')
    ->warning('warning');
  $expected = [
    'status' => NAGIOS_STATUS_WARNING,
    'type' => 'state',
    'text' => 'test warning',
  ];
  self::expectWatchdog($expected);
  $this
    ->getLogger('test')
    ->error('error');
  $expected = [
    'status' => NAGIOS_STATUS_CRITICAL,
    'type' => 'state',
    'text' => 'test error, test warning',
  ];
  self::expectWatchdog($expected);
}