function MigrateFileTest::migrateDumpAlter

Same name in other branches
  1. 9 core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateFileTest::migrateDumpAlter()
  2. 8.9.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateFileTest::migrateDumpAlter()
  3. 11.x core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php \Drupal\Tests\file\Kernel\Migrate\d6\MigrateFileTest::migrateDumpAlter()

Overrides MigrateDumpAlterInterface::migrateDumpAlter

File

core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php, line 153

Class

MigrateFileTest
Test file migration.

Namespace

Drupal\Tests\file\Kernel\Migrate\d6

Code

public static function migrateDumpAlter(KernelTestBase $test) {
    $db = Database::getConnection('default', 'migrate');
    $db->update('files')
        ->condition('fid', 3)
        ->fields([
        'filename' => 'image-3.jpg',
        'filepath' => 'core/tests/fixtures/files/image-3.jpg',
    ])
        ->execute();
    $file = (array) $db->select('files')
        ->fields('files')
        ->condition('fid', 5)
        ->execute()
        ->fetchObject();
    unset($file['fid']);
    $db->insert('files')
        ->fields($file)
        ->execute();
    return static::$tempFilename;
}

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