You are here

public function SettingsTest::testSettings in System Status 8.2

Tests the settings form.

File

tests/src/Functional/SettingsTest.php, line 19

Class

SettingsTest
Tests the settings.

Namespace

Drupal\Tests\system_status\Functional

Code

public function testSettings() {

  // Make sure we can't access settings without permissions.
  $this
    ->drupalGet('/admin/config/system/system-status');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $account = $this
    ->createUser([
    'administer site configuration',
  ]);
  $this
    ->drupalLogin($account);
  $this
    ->drupalGet('/admin/config/system/system-status');
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Make sure api keys gets populated.
  $key = $this
    ->getSession()
    ->getPage()
    ->find('css', 'input[name="system_status_service"]');
  $this
    ->assertNotEmpty($key);
}