You are here

public function MonitoringCoreWebTest::testUpdateRequirementsSensors in Monitoring 8

Tests that requirements sensors are properly updated when installing and uninstalling a module.

File

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

Class

MonitoringCoreWebTest
Integration tests for the core pieces of monitoring.

Namespace

Drupal\Tests\monitoring\Functional

Code

public function testUpdateRequirementsSensors() {

  // Create and login user with permission to view monitoring reports.
  $test_user = $this
    ->drupalCreateUser([
    'monitoring reports',
    'administer monitoring',
  ]);
  $this
    ->drupalLogin($test_user);

  // Assert updates when installing and uninstalling the past module.
  $this
    ->drupalGet('admin/reports/monitoring');
  $this
    ->assertNoRaw('<span title="Requirements of the past module">Module past</span>');
  $this
    ->installModules([
    'past',
  ]);
  $this
    ->drupalGet('admin/reports/monitoring');
  $this
    ->assertRaw('<span title="Requirements of the past module">Module past</span>');
  $this
    ->uninstallModules([
    'past',
  ]);
  $this
    ->drupalGet('admin/reports/monitoring');
  $this
    ->assertNoRaw('<span title="Requirements of the past module">Module past</span>');

  // Assert the rebuild update changes.
  $this
    ->drupalGet('/admin/config/system/monitoring/sensors/rebuild');
  $this
    ->assertText('No changes were made.');
}