function SyslogTest::testSettings

Same name in other branches
  1. 9 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest::testSettings()
  2. 8.9.x core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest::testSettings()
  3. 10 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest::testSettings()

Tests the syslog settings page.

File

core/modules/syslog/tests/src/Functional/SyslogTest.php, line 29

Class

SyslogTest
Tests syslog settings.

Namespace

Drupal\Tests\syslog\Functional

Code

public function testSettings() : void {
    $admin_user = $this->drupalCreateUser([
        'administer site configuration',
    ]);
    $this->drupalLogin($admin_user);
    // If we're on Windows, there is no configuration form.
    if (defined('LOG_LOCAL6')) {
        $this->drupalGet('admin/config/development/logging');
        $this->submitForm([
            'syslog_facility' => LOG_LOCAL6,
        ], 'Save configuration');
        $this->assertSession()
            ->pageTextContains('The configuration options have been saved.');
        $this->drupalGet('admin/config/development/logging');
        // Should be one field.
        $field = $this->assertSession()
            ->elementExists('xpath', '//option[@value="' . LOG_LOCAL6 . '"]');
        $this->assertSame('selected', $field->getAttribute('selected'), 'Facility value saved.');
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.