DrupalWebTestCase::refreshVariables

  1. drupal
    1. 8
    2. 7
Versions
7 protected DrupalWebTestCase::refreshVariables()

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

In other words calling a settings page with $this->drupalPost() 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.

Code

modules/simpletest/drupal_web_test_case.php, line 1436

<?php
protected function refreshVariables() {
  global $conf;
  cache_clear_all('variables', 'cache_bootstrap');
  $conf = variable_initialize();
}
?>