You are here

class SyslogTest in Drupal 10

Same name in this branch
  1. 10 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest
  2. 10 core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest
  3. 10 core/modules/syslog/tests/modules/syslog_test/src/Logger/SysLogTest.php \Drupal\syslog_test\Logger\SysLogTest
Same name and namespace in other branches
  1. 8 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\SyslogTest
  2. 9 core/modules/syslog/tests/src/Functional/SyslogTest.php \Drupal\Tests\syslog\Functional\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
        ->xpath('//option[@value=:value]', [
        ':value' => LOG_LOCAL6,
      ]);
      $this
        ->assertSame('selected', $field[0]
        ->getAttribute('selected'), 'Facility value saved.');
    }
  }

}

Members