You are here

public function MonitoringCoreWebTest::doTestQueueSizeSensor in Monitoring 8

Tests creation of sensor through UI.

1 call to MonitoringCoreWebTest::doTestQueueSizeSensor()
MonitoringCoreWebTest::testSensors in tests/src/Functional/MonitoringCoreWebTest.php
Tests individual sensors.

File

tests/src/Functional/MonitoringCoreWebTest.php, line 42

Class

MonitoringCoreWebTest
Integration tests for the core pieces of monitoring.

Namespace

Drupal\Tests\monitoring\Functional

Code

public function doTestQueueSizeSensor() {
  $account = $this
    ->drupalCreateUser([
    'administer monitoring',
    'monitoring reports',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet('admin/config/system/monitoring/sensors/add');
  $this
    ->assertFieldByName('status', TRUE);

  // Test creation of Node entity aggregator sensor.
  $this
    ->drupalPostForm('admin/config/system/monitoring/sensors/add', [
    'label' => 'QueueTest',
    'id' => 'queue_size_test',
    'plugin_id' => 'queue_size',
  ], 'Select sensor');
  $this
    ->assertOption('edit-settings-queue', 'monitoring_test');
  $this
    ->assertOptionByText('edit-settings-queue', 'Test Worker');
  $edit = [
    'settings[queue]' => 'monitoring_test',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->assertText('Sensor QueueTest saved.');
}