function SyslogTest::testSyslogMissingFacility

Same name in other branches
  1. 10 core/modules/syslog/tests/src/Kernel/SyslogTest.php \Drupal\Tests\syslog\Kernel\SyslogTest::testSyslogMissingFacility()

Tests that missing facility prevents writing to the syslog.

@covers ::openConnection

File

core/modules/syslog/tests/src/Kernel/SyslogTest.php, line 78

Class

SyslogTest
Test syslog logger functionality.

Namespace

Drupal\Tests\syslog\Kernel

Code

public function testSyslogMissingFacility() : void {
    $config = $this->container
        ->get('config.factory')
        ->getEditable('syslog.settings');
    $config->clear('facility');
    $config->save();
    \Drupal::logger('my_module')->warning('My warning message.');
    $log_filename = $this->container
        ->get('file_system')
        ->realpath('public://syslog.log');
    $this->assertFileDoesNotExist($log_filename);
}

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