You are here

protected function MigrateUserTest::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php \Drupal\user\Tests\Migrate\d6\MigrateUserTest::setUp()
  2. 8 core/modules/user/src/Tests/Migrate/d7/MigrateUserTest.php \Drupal\user\Tests\Migrate\d7\MigrateUserTest::setUp()
Same name and namespace in other branches
  1. 8.0 core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php \Drupal\user\Tests\Migrate\d6\MigrateUserTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides MigrateDrupal6TestBase::setUp

File

core/modules/user/src/Tests/Migrate/d6/MigrateUserTest.php, line 28
Contains \Drupal\user\Tests\Migrate\d6\MigrateUserTest.

Class

MigrateUserTest
Users migration.

Namespace

Drupal\user\Tests\Migrate\d6

Code

protected function setUp() {
  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(array(
    'fid' => 2,
    'uid' => 2,
    'filename' => 'image-test.jpg',
    'uri' => "public://image-test.jpg",
    'filemime' => 'image/jpeg',
    'created' => 1,
    'changed' => 1,
    'status' => FILE_STATUS_PERMANENT,
  ));
  $file
    ->enforceIsNew();
  file_put_contents($file
    ->getFileUri(), file_get_contents('core/modules/simpletest/files/image-1.png'));
  $file
    ->save();
  $file = File::create(array(
    'fid' => 8,
    'uid' => 8,
    'filename' => 'image-test.png',
    'uri' => "public://image-test.png",
    'filemime' => 'image/png',
    'created' => 1,
    'changed' => 1,
    'status' => FILE_STATUS_PERMANENT,
  ));
  $file
    ->enforceIsNew();
  file_put_contents($file
    ->getFileUri(), file_get_contents('core/modules/simpletest/files/image-2.jpg'));
  $file
    ->save();
  $this
    ->migrateUsers();
}