You are here

function MonitoringMuninTest::testMultigraphsDefaultSettings in Monitoring 7

Tests Munin default settings enabled after module installation.

File

modules/monitoring_munin/monitoring_munin.test, line 59
Monitoring munin tests.

Class

MonitoringMuninTest
Class MonitoringAPITest

Code

function testMultigraphsDefaultSettings() {

  // When enabled we should have Watchdog and User activity multigraphs
  // created.
  $multigraphs = monitoring_munin_multigraphs();
  $this
    ->assertEqual($multigraphs, array(
    'Watchdog' => array(
      'title' => 'Watchdog',
      'vlabel' => 'Watchdog items',
    ),
    'User activity' => array(
      'title' => 'User activity',
      'vlabel' => 'Users',
    ),
  ));
  foreach (monitoring_sensor_info_by_categories() as $category => $sensors) {
    if (!isset($multigraphs[$category])) {
      continue;
    }

    /** @var \Drupal\monitoring\Sensor\SensorInfo $sensor */
    foreach ($sensors as $sensor) {
      $munin_settings = $sensor
        ->getSetting('munin');
      $this
        ->assertTrue($munin_settings['munin_enabled']);
      $this
        ->assertEqual($munin_settings['multigraphs'], array(
        $category,
      ));
    }
  }
}