Skip to content

Commit

Permalink
Fixed variables trait not preserving declared valriables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Skrypnyk committed Jan 11, 2022
1 parent df4fb50 commit a39cd89
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/D7/VariableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ protected function variableCleanupTestVariables() {
protected function variableRefresh() {
global $conf;
cache_clear_all('variables', 'cache_bootstrap');
$conf = variable_initialize();
$conf = variable_initialize($conf);
}

}
16 changes: 16 additions & 0 deletions tests/behat/features/d7.variable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,19 @@ Feature: Check that variable assertions work for D7
Line3
"""
And I delete test variable "random_test_var6"

@api
Scenario: Preserving variables set in settings
Given variable "test_var" has value "123"
When I set test variable "random_test_var4" to value "init"
Then variable "random_test_var4" has value "init"
And variable "test_var" has value "123"

@api
Scenario: Overriding variables set in settings
Given variable "test_var" has value "123"
When I set test variable "random_test_var4" to value "init"
Then variable "random_test_var4" has value "init"
And variable "test_var" has value "123"
When I set variable "test_var" to value "456"
Then variable "test_var" has value "456"
1 change: 1 addition & 0 deletions tests/behat/fixtures/d7/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
},
"scripts": {
"drupal-post-install": [
"chmod 644 web/sites/default/settings.php; echo '$conf[\"test_var\"]=123;' >> web/sites/default/settings.php; chmod 444 web/sites/default/settings.php",
"drush -r web en mysite_core -y"
]
}
Expand Down

0 comments on commit a39cd89

Please sign in to comment.