diff core/modules/syslog/tests/src/Functional/SyslogTest.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/syslog/tests/src/Functional/SyslogTest.php	Thu Jul 05 14:24:15 2018 +0000
@@ -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.');
+    }
+  }
+
+}