You are here

protected function MigrateUserTest::setUp in Drupal 10

Same name in this branch
  1. 10 core/modules/user/tests/src/Kernel/Migrate/d6/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::setUp()
  2. 10 core/modules/user/tests/src/Kernel/Migrate/d7/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d7\MigrateUserTest::setUp()
Same name and namespace in other branches
  1. 8 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/d6/MigrateUserTest.php \Drupal\Tests\user\Kernel\Migrate\d6\MigrateUserTest::setUp()

Overrides MigrateDrupal6TestBase::setUp

File

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

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();
}