Skip to content
Snippets Groups Projects
Commit 47e76cea authored by catch's avatar catch
Browse files

Issue #3395631 by phenaproxima, hdnag, borisson_, marvil07, Spokje, Wim Leers,...

Issue #3395631 by phenaproxima, hdnag, borisson_, marvil07, Spokje, Wim Leers, catch, dagmar: Add validation constraints to dblog.settings
parent 5cb6498e
No related branches found
No related tags found
No related merge requests found
langcode: en
row_limit: 1000 row_limit: 1000
...@@ -7,3 +7,8 @@ dblog.settings: ...@@ -7,3 +7,8 @@ dblog.settings:
row_limit: row_limit:
type: integer type: integer
label: 'Database log messages to keep' label: 'Database log messages to keep'
constraints:
Range:
min: 0
constraints:
FullyValidatable: ~
...@@ -5,6 +5,18 @@ ...@@ -5,6 +5,18 @@
* Post update functions for the Database Logging module. * Post update functions for the Database Logging module.
*/ */
/**
* Ensures the `dblog.settings` config has a langcode.
*/
function dblog_post_update_add_langcode_to_settings(): void {
$config = \Drupal::configFactory()->getEditable('dblog.settings');
if ($config->get('langcode')) {
return;
}
$config->set('langcode', \Drupal::languageManager()->getDefaultLanguage()->getId())
->save();
}
/** /**
* Implements hook_removed_post_updates(). * Implements hook_removed_post_updates().
*/ */
......
...@@ -304,6 +304,7 @@ private function verifyRowLimit($row_limit) { ...@@ -304,6 +304,7 @@ private function verifyRowLimit($row_limit) {
$edit['dblog_row_limit'] = $row_limit; $edit['dblog_row_limit'] = $row_limit;
$this->drupalGet('admin/config/development/logging'); $this->drupalGet('admin/config/development/logging');
$this->submitForm($edit, 'Save configuration'); $this->submitForm($edit, 'Save configuration');
$this->assertSession()->statusMessageContains('The configuration options have been saved.');
$this->assertSession()->statusCodeEquals(200); $this->assertSession()->statusCodeEquals(200);
// Check row limit variable. // Check row limit variable.
......
...@@ -22,6 +22,18 @@ protected function setDatabaseDumpFiles() { ...@@ -22,6 +22,18 @@ protected function setDatabaseDumpFiles() {
]; ];
} }
/**
* Tests that updating adds a langcode to the dblog.settings config.
*/
public function testAddLangcodeToSettings(): void {
$this->assertEmpty($this->config('dblog.settings')->get('langcode'));
$this->runUpdates();
$default_langcode = $this->container->get('language_manager')
->getDefaultLanguage()
->getId();
$this->assertSame($default_langcode, $this->config('dblog.settings')->get('langcode'));
}
/** /**
* Tests that, after update 10101, the 'wid' column can be a 64-bit integer. * Tests that, after update 10101, the 'wid' column can be a 64-bit integer.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment