You are here

function SyslogTest::testSettings in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/syslog/src/Tests/SyslogTest.php \Drupal\syslog\Tests\SyslogTest::testSettings()

Tests the syslog settings page.

File

core/modules/syslog/src/Tests/SyslogTest.php, line 29
Contains \Drupal\syslog\Tests\SyslogTest.

Class

SyslogTest
Tests syslog settings.

Namespace

Drupal\syslog\Tests

Code

function testSettings() {
  $admin_user = $this
    ->drupalCreateUser(array(
    'administer site configuration',
  ));
  $this
    ->drupalLogin($admin_user);

  // If we're on Windows, there is no configuration form.
  if (defined('LOG_LOCAL6')) {
    $this
      ->drupalPostForm('admin/config/development/logging', array(
      'syslog_facility' => LOG_LOCAL6,
    ), t('Save configuration'));
    $this
      ->assertText(t('The configuration options have been saved.'));
    $this
      ->drupalGet('admin/config/development/logging');
    if ($this
      ->parse()) {
      $field = $this
        ->xpath('//option[@value=:value]', array(
        ':value' => LOG_LOCAL6,
      ));

      // Should be one field.
      $this
        ->assertTrue($field[0]['selected'] == 'selected', 'Facility value saved.');
    }
  }
}