You are here

protected function BrowserTestBase::refreshVariables in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/BrowserTestBase.php \Drupal\simpletest\BrowserTestBase::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->submitForm() 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.

3 calls to BrowserTestBase::refreshVariables()
BrowserTestBase::drupalGet in core/modules/simpletest/src/BrowserTestBase.php
Retrieves a Drupal path or an absolute path.
BrowserTestBase::resetAll in core/modules/simpletest/src/BrowserTestBase.php
Resets all data structures after having enabled new modules.
BrowserTestBase::submitForm in core/modules/simpletest/src/BrowserTestBase.php
Fills and submits a form.

File

core/modules/simpletest/src/BrowserTestBase.php, line 1303
Contains \Drupal\simpletest\BrowserTestBase.

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\simpletest

Code

protected function refreshVariables() {

  // Clear the tag cache.
  // @todo Replace drupal_static() usage within classes and provide a
  //   proper interface for invoking reset() on a cache backend:
  //   https://www.drupal.org/node/2311945.
  drupal_static_reset('Drupal\\Core\\Cache\\CacheBackendInterface::tagCache');
  drupal_static_reset('Drupal\\Core\\Cache\\DatabaseBackend::deletedTags');
  drupal_static_reset('Drupal\\Core\\Cache\\DatabaseBackend::invalidatedTags');
  foreach (Cache::getBins() as $backend) {
    if (is_callable(array(
      $backend,
      'reset',
    ))) {
      $backend
        ->reset();
    }
  }
  $this->container
    ->get('config.factory')
    ->reset();
  $this->container
    ->get('state')
    ->resetCache();
}