You are here

protected function AutoloadTestBase::preloadRegistry in Autoload 7.2

File

src/Tests/Unit/AutoloadTestBase.php, line 65

Class

AutoloadTestBase
Class UnitTest.

Namespace

Drupal\autoload\Tests\Unit

Code

protected function preloadRegistry() {
  parent::preloadRegistry();

  // Tests, possibly, doesn't have a writing permissions to a filesystem.
  // So, let's just use actual generated file.
  //
  // WE MUST set this variable here and in this way because "setUp()" runs
  // "resetAll()" method which triggers Drupal cache clearing during which
  // a lot of modules start collecting the data to fill the cache (e.g.
  // "entity", "views" etc.). In a case of using autoloading in one of the
  // hooks providing the data, we'll get a fatal error not doing this.

  /* @see entity_views_data() */
  variable_set('autoload_file', $this->autoloadFile);
}