class SyslogTest

Same name in this branch
  1. 9 core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest
  2. 9 core/modules/syslog/tests/modules/syslog_test/src/Logger/SysLogTest.php \Drupal\syslog_test\Logger\SysLogTest
Same name and namespace in other branches
  1. 11.x core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest
  2. 11.x core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest
  3. 11.x core/modules/syslog/tests/modules/syslog_test/src/Logger/SysLogTest.php \Drupal\syslog_test\Logger\SysLogTest
  4. 10 core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest
  5. 10 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest
  6. 10 core/modules/syslog/tests/modules/syslog_test/src/Logger/SysLogTest.php \Drupal\syslog_test\Logger\SysLogTest
  7. 8.9.x core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest
  8. 8.9.x core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest
  9. 8.9.x core/modules/syslog/tests/modules/syslog_test/src/Logger/SysLogTest.php \Drupal\syslog_test\Logger\SysLogTest

Tests syslog settings.

@group syslog

Hierarchy

Expanded class hierarchy of SyslogTest

File

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

Namespace

Drupal\Tests\syslog\Functional
View source
class SyslogTest extends BrowserTestBase {
  
  /**
   * Modules to enable.
   *
   * @var array
   */
  protected static $modules = [
    'syslog',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * 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->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.