Issue #2534760 by mr.baileys, GeduR, phenaproxima, dagmar, tstoeckler: syslog.settings.facility should be an integer
parent
a132d4584d
commit
1a4d61e516
|
@ -1,3 +1,6 @@
|
|||
identity: drupal
|
||||
facility: ''
|
||||
# The default facility setting depends on the operating system, and will be
|
||||
# overwritten during installation.
|
||||
# @see syslog_install().
|
||||
facility: 8
|
||||
format: '!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message'
|
||||
|
|
|
@ -8,7 +8,7 @@ syslog.settings:
|
|||
type: string
|
||||
label: 'Identity'
|
||||
facility:
|
||||
type: string
|
||||
type: integer
|
||||
label: 'Facility'
|
||||
format:
|
||||
type: string
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\syslog\Tests\Update;
|
||||
|
||||
use Drupal\system\Tests\Update\UpdatePathTestBase;
|
||||
|
||||
/**
|
||||
* Tests that syslog settings are properly updated during database updates.
|
||||
*
|
||||
* @group syslog
|
||||
*/
|
||||
class SyslogUpdateTest extends UpdatePathTestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setDatabaseDumpFiles() {
|
||||
$this->databaseDumpFiles = [
|
||||
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that syslog.settings.facility has been converted from string to int.
|
||||
*
|
||||
* @see syslog_update_8400()
|
||||
*/
|
||||
public function testSyslogSettingsFacilityDataType() {
|
||||
$config = $this->config('syslog.settings');
|
||||
$this->assertIdentical('128', $config->get('facility'));
|
||||
|
||||
// Run updates.
|
||||
$this->runUpdates();
|
||||
|
||||
$config = $this->config('syslog.settings');
|
||||
$this->assertIdentical(128, $config->get('facility'));
|
||||
}
|
||||
|
||||
}
|
|
@ -13,3 +13,12 @@ function syslog_install() {
|
|||
// to be set dynamically during installation.
|
||||
\Drupal::configFactory()->getEditable('syslog.settings')->set('facility', defined('LOG_LOCAL0') ? LOG_LOCAL0 : LOG_USER)->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert syslog.settings.facility to an integer.
|
||||
*/
|
||||
function syslog_update_8400() {
|
||||
$config = \Drupal::configFactory()->getEditable('syslog.settings');
|
||||
$facility = (int) $config->get('facility');
|
||||
$config->set('facility', $facility)->save(TRUE);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class MigrateSyslogConfigsTest extends MigrateDrupal6TestBase {
|
|||
public function testSyslogSettings() {
|
||||
$config = $this->config('syslog.settings');
|
||||
$this->assertIdentical('drupal', $config->get('identity'));
|
||||
$this->assertIdentical('128', $config->get('facility'));
|
||||
$this->assertIdentical(128, $config->get('facility'));
|
||||
$this->assertConfigSchema(\Drupal::service('config.typed'), 'syslog.settings', $config->get());
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class MigrateSyslogConfigsTest extends MigrateDrupal7TestBase {
|
|||
public function testSyslogSettings() {
|
||||
$config = $this->config('syslog.settings');
|
||||
// 8 == LOG_USER
|
||||
$this->assertIdentical('8', $config->get('facility'));
|
||||
$this->assertIdentical(8, $config->get('facility'));
|
||||
$this->assertIdentical('!base_url|!timestamp|!type|!ip|!request_uri|!referer|!uid|!link|!message', $config->get('format'));
|
||||
$this->assertIdentical('drupal', $config->get('identity'));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue