migrateUsers example


  protected function setUp(): void {
    parent::setUp();

    // Remove the classic node table made in setup.     $this->removeNodeMigrateMapTable(NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC, '6');

    $this->installSchema('node', ['node_access']);
    $this->installEntitySchema('node');

    $this->executeMigration('language');
    $this->migrateUsers(FALSE);
    $this->migrateFields();
    $this->executeMigrations(['d6_node_settings', 'd6_node_complete']);
    $this->migrateTaxonomy();
    // This is a base plugin ID and we want to run all derivatives.     $this->executeMigrations(['d6_term_node']);
  }

  /** * Tests the Drupal 6 term-node association to Drupal 8 migration. */
  public function testTermNode() {
    
'menu_link_content',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('shortcut');
    $this->installEntitySchema('menu_link_content');
    $this->installSchema('shortcut', ['shortcut_set_users']);
    $this->migrateUsers(FALSE);
    $this->executeMigration('d7_shortcut_set');
    $this->executeMigration('d7_menu');
    $this->executeMigration('d7_shortcut');
    $this->executeMigration('d7_shortcut_set_users');
  }

  /** * Tests the shortcut set migration. */
  public function testShortcutSetUsersMigration() {
    // Check if migrated user has correct migrated shortcut set assigned.

  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('node');
    $this->installConfig(static::$modules);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('tracker', ['tracker_node', 'tracker_user']);

    $this->migrateContentTypes();
    $this->migrateUsers(FALSE);
    $this->executeMigrations([
      'd7_node',
      'd7_tracker_node',
    ]);
  }

  /** * Tests migration of tracker node table. */
  public function testMigrateTrackerNode() {
    $connection = Database::getConnection('default', 'migrate');
    
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->setUpCurrentUser();

    $this->installSchema('node', ['node_access']);

    $this->migrateUsers(FALSE);
    $this->migrateContentTypes();
    $this->executeMigrations([
      'language',
      'd7_language_types',
      'd7_language_negotiation_settings',
      'd7_node',
      'd7_node_translation',
    ]);
  }

  /** * Tests that not found node translations are redirected. */
'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();
  }

  /** * Tests the Drupal6 user to Drupal 8 migration. */
  public function testUser() {
    $users = Database::getConnection('default', 'migrate')
      ->select('users', 'u')
      ->fields('u')
      ->condition('uid', 0, '>')
      ->execute()
      

  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('node');
    $this->installConfig(static::$modules);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('tracker', ['tracker_node', 'tracker_user']);

    $this->migrateContentTypes();
    $this->migrateUsers(FALSE);
    $this->executeMigrations([
      'd7_node',
      'd7_tracker_node',
    ]);
  }

  /** * Tests migration of tracker user table. */
  public function testMigrateTrackerUser() {
    $connection = Database::getConnection('default', 'migrate');
    


  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installEntitySchema('file');

    $this->migrateTaxonomyTerms();
    $this->migrateUsers(FALSE);
    $this->executeMigration('d7_node:article');
  }

  /** * Tests node migration from Drupal 7 to 8. */
  public function testMigration() {
    $node = Node::load(2);
    $this->assertInstanceOf(NodeInterface::class$node);
    $this->assertEquals(9, $node->field_tags[0]->target_id);
    $this->assertEquals(14, $node->field_tags[1]->target_id);
    

  protected function setUp(): void {
    parent::setUp();

    $this->fileMigrationSetup();

    $this->installEntitySchema('comment');
    $this->installEntitySchema('taxonomy_term');
    $this->installSchema('comment', ['comment_entity_statistics']);
    $this->installSchema('node', ['node_access']);

    $this->migrateUsers();
    $this->migrateFields();
    $this->migrateTaxonomyTerms();
    $this->executeMigrations([
      'language',
      'd7_language_content_taxonomy_vocabulary_settings',
      'd7_taxonomy_term_localized_translation',
      'd7_taxonomy_term_translation',
      'd7_language_content_settings',
      'd7_comment_field',
      'd7_comment_field_instance',
      'd7_node',
      
/** * Executes all content migrations. * * @param array $include * Extra things to include as part of the migrations. Values may be * 'revisions' or 'translations'. */
  protected function migrateContent(array $include = []) {
    if (in_array('translations', $include)) {
      $this->executeMigrations(['language']);
    }
    $this->migrateUsers(FALSE);
    $this->migrateFields();

    $this->installEntitySchema('node');
    $this->executeMigrations(['d6_node_settings', 'd6_node']);

    if (in_array('translations', $include)) {
      $this->executeMigrations(['d6_node_translation']);
    }
    if (in_array('revisions', $include)) {
      $this->executeMigrations(['d6_node_revision']);
    }
  }
protected function setUp(): void {
    parent::setUp();

    $this->fileMigrationSetup();

    $this->installEntitySchema('node');
    $this->installEntitySchema('comment');
    $this->installEntitySchema('taxonomy_term');
    $this->installSchema('comment', ['comment_entity_statistics']);
    $this->installSchema('node', ['node_access']);

    $this->migrateUsers();
    $this->migrateFields();
    $this->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_comment_field',
      'd7_comment_field_instance',
      'd7_node',
      'd7_node_translation',
      'd7_node_revision',
    ]);
    $this->nodeStorage = $this->container->get('entity_type.manager')
      
'node',
    'text',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installSchema('book', ['book']);
    $this->installSchema('node', ['node_access']);
    $this->migrateUsers(FALSE);
    $this->migrateContentTypes();
    $this->executeMigrations([
      'd7_node',
      'd7_book',
    ]);
  }

  /** * Tests the Drupal 7 book structure to Drupal 8 migration. */
  public function testBook() {
    
/** * {@inheritdoc} */
  protected static $modules = ['contact'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->migrateUsers(FALSE);
    $this->installSchema('user', ['users_data']);
    $this->executeMigration('d6_user_contact_settings');
  }

  /** * Tests the Drupal6 user contact settings migration. */
  public function testUserContactSettings() {
    $user_data = \Drupal::service('user.data');
    $module = $key = 'contact';
    $uid = 2;
    


  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->installSchema('node', ['node_access']);
    $this->installSchema('statistics', ['node_counter']);

    $this->migrateUsers(FALSE);
    $this->migrateContentTypes();
    $this->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_node',
      'd7_node_translation',
      'statistics_node_counter',
    ]);
  }

  /** * Tests migration of node counter. */

  protected function setUp(): void {
    parent::setUp();

    $this->executeMigrations([
      'language',
      'user_profile_field',
      'user_profile_field_instance',
      'user_profile_entity_display',
      'user_profile_entity_form_display',
    ]);
    $this->migrateUsers(FALSE);
    $this->executeMigration('d6_profile_values');
  }

  /** * Tests Drupal 6 profile values to Drupal 8 migration. */
  public function testUserProfileValues() {
    $user = User::load(2);
    $this->assertNotNull($user);
    $this->assertSame('red', $user->profile_color->value);
    // cSpell:disable
$this->installSchema('system', ['sequences']);

    // Create a new user which needs to have UID 1, because that is expected by     // the assertions from     // \Drupal\migrate_drupal\Tests\d6\MigrateNodeRevisionTest.     User::create([
      'uid' => 1,
      'name' => $this->randomMachineName(),
      'status' => 1,
    ])->enforceIsNew()->save();

    $this->migrateUsers(FALSE);
    $this->migrateFields();
    $this->executeMigration('d6_node_settings');
  }

}
Home | Imprint | This part of the site doesn't use cookies.