Version 1
[yaffs-website] / web / core / modules / syslog / tests / src / Functional / SyslogTest.php
diff --git a/web/core/modules/syslog/tests/src/Functional/SyslogTest.php b/web/core/modules/syslog/tests/src/Functional/SyslogTest.php
new file mode 100644 (file)
index 0000000..11b577f
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+namespace Drupal\Tests\syslog\Functional;
+
+use Drupal\Tests\BrowserTestBase;
+
+/**
+ * Tests syslog settings.
+ *
+ * @group syslog
+ */
+class SyslogTest extends BrowserTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = ['syslog'];
+
+  /**
+   * Tests the syslog settings page.
+   */
+  public function testSettings() {
+    $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->drupalPostForm('admin/config/development/logging', ['syslog_facility' => LOG_LOCAL6], t('Save configuration'));
+      $this->assertText(t('The configuration options have been saved.'));
+
+      $this->drupalGet('admin/config/development/logging');
+      // Should be one field.
+      $field = $this->xpath('//option[@value=:value]', [':value' => LOG_LOCAL6]);
+      $this->assertSame('selected', $field[0]->getAttribute('selected'), 'Facility value saved.');
+    }
+  }
+
+}