/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Create some fields so the data gets stored. entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_color', 'type' => 'text'))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_biography', 'type' => 'text_long'))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_sell_address', 'type' => 'boolean'))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_sold_to', 'type' => 'list_string', 'settings' => array('allowed_values' => array('Pill spammers' => 'Pill spammers', 'Fitness spammers' => 'Fitness spammers'))))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_bands', 'type' => 'text', 'cardinality' => -1))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_blog', 'type' => 'link'))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_birthdate', 'type' => 'datetime'))->save(); entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'profile_love_migrations', 'type' => 'boolean'))->save(); // Create the field instances. foreach (Drupal6UserProfileFields::getData('profile_fields') as $field) { entity_create('field_config', array('label' => $field['title'], 'description' => '', 'field_name' => $field['name'], 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save(); } // Create some users to migrate the profile data to. foreach (Drupal6User::getData('users') as $u) { $user = entity_create('user', $u); $user->enforceIsNew(); $user->save(); } // Add some id mappings for the dependant migrations. $id_mappings = array('d6_user_profile_field_instance' => array(array(array(1), array('user', 'user', 'fieldname'))), 'd6_user_profile_entity_display' => array(array(array(1), array('user', 'user', 'default', 'fieldname'))), 'd6_user_profile_entity_form_display' => array(array(array(1), array('user', 'user', 'default', 'fieldname'))), 'd6_user' => array(array(array(2), array(2)), array(array(8), array(8)), array(array(15), array(15)))); $this->prepareMigrations($id_mappings); // Load database dumps to provide source data. $dumps = array($this->getDumpDirectory() . '/Drupal6UserProfileFields.php', $this->getDumpDirectory() . '/Drupal6User.php'); $this->loadDumps($dumps); // Migrate profile fields. $migration_format = entity_load('migration', 'd6_profile_values:user'); $executable = new MigrateExecutable($migration_format, $this); $executable->import(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Create our users for the node authors. foreach (Drupal6User::getData('users') as $u) { $user = entity_create('user', $u); $user->enforceIsNew(); $user->save(); } $id_mappings = array('d6_node' => array(array(array(1), array(1)))); $this->prepareMigrations($id_mappings); $dumps = array($this->getDumpDirectory() . '/Drupal6NodeRevision.php'); $this->loadDumps($dumps); /** @var \Drupal\migrate\entity\Migration $migration */ $migration = entity_load('migration', 'd6_node_revision'); $executable = new MigrateExecutable($migration, $this); $executable->import(); }