You are here

protected function WebTestBase::refreshVariables in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/WebTestBase.php \Drupal\simpletest\WebTestBase::refreshVariables()

Refreshes in-memory configuration and state information.

Useful after a page request is made that changes configuration or state in a different thread.

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

This method clears the cache and loads a fresh copy.

14 calls to WebTestBase::refreshVariables()
FormatDateTest::setUp in core/modules/system/src/Tests/Common/FormatDateTest.php
Sets up a Drupal site for running functional and integration tests.
InstallerTestBase::refreshVariables in core/modules/simpletest/src/InstallerTestBase.php
WebTestBase::refreshVariables() tries to operate on persistent storage, which is only available after the installer completed.
LanguageNegotiationInfoTest::stateSet in core/modules/language/src/Tests/LanguageNegotiationInfoTest.php
Sets state flags for language_test module.
RESTTestBase::httpRequest in core/modules/rest/src/Tests/RESTTestBase.php
Helper function to issue a HTTP request with simpletest's cURL.
SearchEmbedFormTest::setUp in core/modules/search/src/Tests/SearchEmbedFormTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

1 method overrides WebTestBase::refreshVariables()
InstallerTestBase::refreshVariables in core/modules/simpletest/src/InstallerTestBase.php
WebTestBase::refreshVariables() tries to operate on persistent storage, which is only available after the installer completed.

File

core/modules/simpletest/src/WebTestBase.php, line 1211
Contains \Drupal\simpletest\WebTestBase.

Class

WebTestBase
Test case for typical Drupal tests.

Namespace

Drupal\simpletest

Code

protected function refreshVariables() {

  // Clear the tag cache.
  \Drupal::service('cache_tags.invalidator')
    ->resetChecksums();
  foreach (Cache::getBins() as $backend) {
    if (is_callable(array(
      $backend,
      'reset',
    ))) {
      $backend
        ->reset();
    }
  }
  $this->container
    ->get('config.factory')
    ->reset();
  $this->container
    ->get('state')
    ->resetCache();
}