function MigrateDrupalTestBase::loadFixture

Same name in other branches
  1. 8.9.x core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase::loadFixture()
  2. 10 core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase::loadFixture()
  3. 11.x core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php \Drupal\Tests\migrate_drupal\Kernel\MigrateDrupalTestBase::loadFixture()

Loads a database fixture into the source database connection.

Parameters

string $path: Path to the dump file.

6 calls to MigrateDrupalTestBase::loadFixture()
MigrateDrupal6TestBase::setUp in core/modules/migrate_drupal/tests/src/Kernel/d6/MigrateDrupal6TestBase.php
MigrateDrupal6TestBase::setUp in core/modules/aggregator/tests/src/Kernel/Migrate/d6/MigrateDrupal6TestBase.php
MigrateDrupal7TestBase::setUp in core/modules/migrate_drupal/tests/src/Kernel/d7/MigrateDrupal7TestBase.php
MigrateDrupal7TestBase::setUp in core/modules/aggregator/tests/src/Kernel/Migrate/d7/MigrateDrupal7TestBase.php
MigrateDrupalTestBase::setUp in core/modules/tracker/tests/src/Kernel/Migrate/d7/MigrateDrupalTestBase.php

... See full list

File

core/modules/migrate_drupal/tests/src/Kernel/MigrateDrupalTestBase.php, line 56

Class

MigrateDrupalTestBase
Base class for Drupal migration tests.

Namespace

Drupal\Tests\migrate_drupal\Kernel

Code

protected function loadFixture($path) {
    $default_db = Database::getConnection()->getKey();
    Database::setActiveConnection($this->sourceDatabase
        ->getKey());
    if (substr($path, -3) == '.gz') {
        $path = 'compress.zlib://' . $path;
    }
    require $path;
    Database::setActiveConnection($default_db);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.