1. drupal
    1. 8
    2. 7
7 protected DrupalWebTestCase::preloadRegistry()

Preload the registry from the testing site.

This method is called by DrupalWebTestCase::setUp(), and preloads the registry from the testing site to cut down on the time it takes to set up a clean environment for the current test run.


modules/simpletest/drupal_web_test_case.php, line 1369

protected function preloadRegistry() {
  // Use two separate queries, each with their own connections: copy the
  // {registry} and {registry_file} tables over from the parent installation
  // to the child installation.
  $original_connection = Database::getConnection('default', 'simpletest_original_default');
  $test_connection = Database::getConnection();

  foreach (array('registry', 'registry_file') as $table) {
    // Find the records from the parent database.
    $source_query = $original_connection
        ->select($table, array(), array('fetch' => PDO::FETCH_ASSOC))

    $dest_query = $test_connection->insert($table);

    $first = TRUE;
    foreach ($source_query->execute() as $row) {
      if ($first) {
        $first = FALSE;
      // Insert the records into the child database.