protected function WebTestBase::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.

16 calls to WebTestBase::refreshVariables()
FormatDateTest::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Common/FormatDateTest.php
Sets up a Drupal site for running functional and integration tests.
MatchPathTest::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php
Sets up a Drupal site for running functional and integration tests.
SearchEmbedFormTest::setUp in drupal/core/modules/search/lib/Drupal/search/Tests/SearchEmbedFormTest.php
Sets up a Drupal site for running functional and integration tests.
SearchExactTest::testExactQuery in drupal/core/modules/search/lib/Drupal/search/Tests/SearchExactTest.php
Tests that the correct number of pager links are found for both keywords and phrases.
SearchNodeAccessTest::testPhraseSearchPunctuation in drupal/core/modules/search/lib/Drupal/search/Tests/SearchNodeAccessTest.php
Tests that search returns results with punctuation in the search phrase.

... See full list

1 method overrides WebTestBase::refreshVariables()
UpgradePathTestBase::refreshVariables in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/UpgradePathTestBase.php
Specialized refreshVariables().

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php, line 807
Definition of Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

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