function MigrateUserTest::setUp

Same name in this branch
  1. 10 core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserTest::setUp()
Same name in other branches
  1. 9 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::setUp()
  2. 9 core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserTest::setUp()
  3. 8.9.x core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::setUp()
  4. 8.9.x core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserTest::setUp()
  5. 11.x core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::setUp()
  6. 11.x core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserTest::setUp()

Overrides MigrateDrupal6TestBase::setUp

File

core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserTest.php, line 32

Class

MigrateUserTest
Users migration.

Namespace

Drupal\Tests\user\Kernel\Migrate\d6

Code

protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('file');
    $this->installSchema('file', [
        'file_usage',
    ]);
    $this->installEntitySchema('node');
    $this->installSchema('user', [
        'users_data',
    ]);
    // Make sure uid 1 is created.
    user_install();
    $file = File::create([
        'fid' => 2,
        'uid' => 2,
        'filename' => 'image-test.jpg',
        'uri' => "public://image-test.jpg",
        'filemime' => 'image/jpeg',
        'created' => 1,
        'changed' => 1,
    ]);
    $file->setPermanent();
    $file->enforceIsNew();
    file_put_contents($file->getFileUri(), file_get_contents('core/tests/fixtures/files/image-1.png'));
    $file->save();
    $file = File::create([
        'fid' => 8,
        'uid' => 8,
        'filename' => 'image-test.png',
        'uri' => "public://image-test.png",
        'filemime' => 'image/png',
        'created' => 1,
        'changed' => 1,
    ]);
    $file->setPermanent();
    $file->enforceIsNew();
    file_put_contents($file->getFileUri(), file_get_contents('core/tests/fixtures/files/image-2.jpg'));
    $file->save();
    $this->executeMigration('language');
    $this->migrateUsers();
}

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