SyslogTest.php

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

Namespace

Drupal\Tests\syslog\Functional

File

core/modules/syslog/tests/src/Functional/SyslogTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\syslog\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests syslog settings.
 *
 * @group syslog
 */
class SyslogTest extends BrowserTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'syslog',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * Tests the syslog settings page.
     */
    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.');
        }
    }

}

Classes

Title Deprecated Summary
SyslogTest Tests syslog settings.

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