1 backdrop_web_test_case.php protected BackdropWebTestCase::refreshVariables()

Refresh the in-memory set of variables and state values. Useful after a page request is made that changes a variable in a different thread.

In other words calling a settings page with $this->backdropPost() with a changed value would update a variable to reflect that change, but in the thread that made the call (thread running the test) the changed variable would not be picked up.

This method clears the variables cache and loads a fresh copy from the database to ensure that the most up-to-date set of variables is loaded.

File

core/modules/simpletest/backdrop_web_test_case.php, line 1853

Class

BackdropWebTestCase
Test case for typical Backdrop tests.

Code

protected function refreshVariables() {
  global $conf;
  cache('bootstrap')->delete('variables');
  $conf = variable_initialize();
  backdrop_static_reset('states');
  backdrop_static_reset('config');
}