/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('file'); $this->installEntitySchema('node'); $this->installSchema('file', ['file_usage']); $this->installSchema('node', ['node_access']); $id_mappings = array('d6_file' => array()); // Create new file entities. for ($i = 1; $i <= 3; $i++) { $file = File::create(array('fid' => $i, 'uid' => 1, 'filename' => 'druplicon.txt', 'uri' => "public://druplicon-{$i}.txt", 'filemime' => 'text/plain', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT)); $file->enforceIsNew(); file_put_contents($file->getFileUri(), 'hello world'); // Save it, inserting a new record. $file->save(); $id_mappings['d6_file'][] = array(array($i), array($i)); } $this->prepareMigrations($id_mappings); $this->migrateContent(); // Since we are only testing a subset of the file migration, do not check // that the full file migration has been run. $migration = Migration::load('d6_upload'); $migration->set('requirements', []); $this->executeMigration($migration); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); // Setup the bundles. entity_create('node_type', array('type' => 'test_page'))->save(); entity_create('node_type', array('type' => 'test_planet'))->save(); entity_create('node_type', array('type' => 'test_story'))->save(); entity_create('node_type', array('type' => 'test_event'))->save(); entity_create('node_type', array('type' => 'story'))->save(); entity_create('node_type', array('type' => 'article'))->save(); entity_create('node_type', array('type' => 'company'))->save(); entity_create('node_type', array('type' => 'employee'))->save(); entity_create('node_type', array('type' => 'page'))->save(); entity_create('node_type', array('type' => 'sponsor'))->save(); entity_create('node_type', array('type' => 'event'))->save(); entity_create('node_type', array('type' => 'book'))->save(); // Create a config entity that already exists. entity_create('base_field_override', array('field_name' => 'promote', 'entity_type' => 'node', 'bundle' => 'page'))->save(); $id_mappings = array('d6_node_type' => array(array(array('test_page'), array('test_page')), array(array('test_planet'), array('test_planet')), array(array('test_story'), array('test_story')), array(array('test_event'), array('test_event')), array(array('story'), array('story')))); $this->prepareMigrations($id_mappings); // Setup the dumps. $migration = entity_load('migration', 'd6_node_setting_promote'); $dumps = array($this->getDumpDirectory() . '/NodeType.php', $this->getDumpDirectory() . '/Variable.php'); $this->prepare($migration, $dumps); // Run the migrations. $executable = new MigrateExecutable($migration, $this); $executable->import(); $migration = entity_load('migration', 'd6_node_setting_status'); $executable = new MigrateExecutable($migration, $this); $executable->import(); $migration = entity_load('migration', 'd6_node_setting_sticky'); $executable = new MigrateExecutable($migration, $this); $executable->import(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(array('node')); $this->loadDumps(['NodeType.php', 'Variable.php']); $this->executeMigration('d6_node_type'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installSchema('system', ['url_alias']); $this->loadDumps(['UrlAlias.php']); $this->executeMigration('d6_url_alias'); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); // Setup the bundles. entity_create('node_type', array('type' => 'test_page'))->save(); entity_create('node_type', array('type' => 'test_planet'))->save(); entity_create('node_type', array('type' => 'test_story'))->save(); entity_create('node_type', array('type' => 'test_event'))->save(); entity_create('node_type', array('type' => 'story'))->save(); entity_create('node_type', array('type' => 'article'))->save(); entity_create('node_type', array('type' => 'company'))->save(); entity_create('node_type', array('type' => 'employee'))->save(); entity_create('node_type', array('type' => 'page'))->save(); entity_create('node_type', array('type' => 'sponsor'))->save(); entity_create('node_type', array('type' => 'event'))->save(); entity_create('node_type', array('type' => 'book'))->save(); // Create a config entity that already exists. entity_create('base_field_override', array('field_name' => 'promote', 'entity_type' => 'node', 'bundle' => 'page'))->save(); $id_mappings = array('d6_node_type' => array(array(array('test_page'), array('test_page')), array(array('test_planet'), array('test_planet')), array(array('test_story'), array('test_story')), array(array('test_event'), array('test_event')), array(array('story'), array('story')))); $this->prepareMigrations($id_mappings); $this->loadDumps(['NodeType.php', 'Variable.php']); $this->executeMigration('d6_node_setting_promote'); $this->executeMigration('d6_node_setting_status'); $this->executeMigration('d6_node_setting_sticky'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->executeMigrations(['user_profile_field', 'user_profile_field_instance', 'user_profile_entity_display', 'user_profile_entity_form_display']); $this->migrateUsers(FALSE); $this->executeMigration('d6_profile_values'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('node'); $this->installConfig(['node']); $this->installSchema('node', ['node_access']); $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(TRUE)->save(); $node_type = entity_create('node_type', array('type' => 'test_planet')); $node_type->save(); node_add_body_field($node_type); $node_type = entity_create('node_type', array('type' => 'story')); $node_type->save(); node_add_body_field($node_type); $id_mappings = array('d6_node_type' => array(array(array('test_story'), array('story'))), 'd6_filter_format' => array(array(array(1), array('filtered_html')), array(array(2), array('full_html'))), 'd6_user' => array(array(array(1), array(1)), array(array(2), array(2))), 'd6_field_instance_widget_settings' => array(array(array('page', 'field_test'), array('node', 'page', 'default', 'test'))), 'd6_field_formatter_settings' => array(array(array('page', 'default', 'node', 'field_test'), array('node', 'page', 'default', 'field_test')))); $this->prepareMigrations($id_mappings); $migration = entity_load('migration', 'd6_node_settings'); $migration->setMigrationResult(MigrationInterface::RESULT_COMPLETED); // Create a test node. $node = entity_create('node', array('type' => 'story', 'nid' => 1, 'vid' => 1, 'revision_log' => '', 'title' => $this->randomString())); $node->enforceIsNew(); $node->save(); $node = entity_create('node', array('type' => 'test_planet', 'nid' => 3, 'vid' => 4, 'revision_log' => '', 'title' => $this->randomString())); $node->enforceIsNew(); $node->save(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); // Create new file entities. for ($i = 1; $i <= 3; $i++) { $file = entity_create('file', array('fid' => $i, 'uid' => 1, 'filename' => 'druplicon.txt', 'uri' => "public://druplicon-{$i}.txt", 'filemime' => 'text/plain', 'created' => 1, 'changed' => 1, 'status' => FILE_STATUS_PERMANENT)); $file->enforceIsNew(); file_put_contents($file->getFileUri(), 'hello world'); // Save it, inserting a new record. $file->save(); $id_mappings['d6_file'][] = array(array($i), array($i)); } // Add a node type. $node_type = entity_create('node_type', array('type' => 'story')); $node_type->save(); // Add a file field. entity_create('field_storage_config', array('field_name' => 'upload', 'entity_type' => 'node', 'type' => 'file', 'cardinality' => -1, 'settings' => array('display_field' => TRUE)))->save(); entity_create('field_config', array('field_name' => 'upload', 'entity_type' => 'node', 'bundle' => 'story'))->save(); $id_mappings['d6_node'] = array(array(array(1), array(1)), array(array(2), array(2))); $this->prepareMigrations($id_mappings); $vids = array(1, 2, 3); for ($i = 1; $i <= 2; $i++) { $node = entity_create('node', array('type' => 'story', 'nid' => $i, 'vid' => array_shift($vids))); $node->enforceIsNew(); $node->save(); if ($i == 1) { $node->vid->value = array_shift($vids); $node->enforceIsNew(FALSE); $node->isDefaultRevision(FALSE); $node->save(); } } $dumps = array($this->getDumpDirectory() . '/Node.php', $this->getDumpDirectory() . '/NodeRevisions.php', $this->getDumpDirectory() . '/ContentTypeStory.php', $this->getDumpDirectory() . '/ContentTypeTestPlanet.php', $this->getDumpDirectory() . '/Upload.php'); $this->loadDumps($dumps); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('aggregator_feed'); $this->installEntitySchema('aggregator_item'); $this->executeMigrations(['d6_aggregator_feed', 'd6_aggregator_item']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->migrateUsers(FALSE); $this->installSchema('user', ['users_data']); $this->executeMigration('d6_user_contact_settings'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(['block_content']); $this->installEntitySchema('block_content'); $this->executeMigrations(['d6_filter_format', 'block_content_type', 'block_content_body_field', 'd6_custom_block']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('aggregator_feed'); $this->loadDumps(['AggregatorFeed.php']); $this->executeMigration('d6_aggregator_feed'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $vocabulary = entity_create('taxonomy_vocabulary', array('vid' => 'test')); $vocabulary->save(); $node_type = entity_create('node_type', array('type' => 'story')); $node_type->save(); foreach (array('vocabulary_1_i_0_', 'vocabulary_2_i_1_', 'vocabulary_3_i_2_') as $name) { entity_create('field_storage_config', array('field_name' => $name, 'entity_type' => 'node', 'type' => 'taxonomy_term_reference', 'cardinality' => -1, 'settings' => array('allowed_values' => array(array('vocabulary' => $vocabulary->id(), 'parent' => '0')))))->save(); entity_create('field_config', array('field_name' => $name, 'entity_type' => 'node', 'bundle' => 'story'))->save(); } $id_mappings = array('d6_vocabulary_field_instance' => array(array(array(1, 'page'), array('node', 'page', 'test'))), 'd6_vocabulary_entity_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_vocabulary_entity_form_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_node' => array(array(array(1), array(1)), array(array(2), array(2)))); $this->prepareMigrations($id_mappings); $vids = array(1, 2, 3); for ($i = 1; $i <= 2; $i++) { $node = entity_create('node', array('type' => 'story', 'nid' => $i, 'vid' => array_shift($vids))); $node->enforceIsNew(); $node->save(); if ($i == 1) { $node->vid->value = array_shift($vids); $node->enforceIsNew(FALSE); $node->setNewRevision(); $node->isDefaultRevision(FALSE); $node->save(); } } $dumps = array($this->getDumpDirectory() . '/Node.php', $this->getDumpDirectory() . '/NodeRevisions.php', $this->getDumpDirectory() . '/ContentTypeStory.php', $this->getDumpDirectory() . '/ContentTypeTestPlanet.php', $this->getDumpDirectory() . '/TermNode.php', $this->getDumpDirectory() . '/TermHierarchy.php', $this->getDumpDirectory() . '/TermData.php', $this->getDumpDirectory() . '/Vocabulary.php', $this->getDumpDirectory() . '/VocabularyNodeTypes.php'); $this->loadDumps($dumps); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installSchema('system', 'router'); $this->container->get('router.builder')->rebuild(); $this->executeMigrations(['d6_user_mail', 'd6_user_settings']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(['node']); $this->executeMigration('d6_node_type'); $this->executeMigration('d6_node_setting_promote'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->prepareMigrations(array('d6_taxonomy_vocabulary' => array(array(array(1), array('vocabulary_1_i_0_'))))); $this->loadDumps(['Variable.php']); $this->executeMigration('d6_forum_settings'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $id_mappings = array('d6_user_picture_field_instance' => array(array(array(1), array('user', 'user', 'user_picture')))); $this->prepareMigrations($id_mappings); $this->executeMigration('d6_user_picture_entity_form_display'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installSchema('system', ['router']); $this->installEntitySchema('menu_link_content'); $this->executeMigrations(['menu', 'menu_links']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installSchema('node', ['node_access']); $this->migrateContent(); $this->migrateTaxonomy(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $migration = entity_load('migration', 'd6_user_picture_field'); $executable = new MigrateExecutable($migration, $this); $executable->import(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('node'); $this->installEntitySchema('taxonomy_term'); $this->installSchema('node', array('node_access')); $vocabulary = entity_create('taxonomy_vocabulary', array('vid' => 'test')); $vocabulary->save(); $node_type = entity_create('node_type', array('type' => 'story')); $node_type->save(); foreach (array('vocabulary_1_i_0_', 'vocabulary_2_i_1_', 'vocabulary_3_i_2_') as $name) { $handler_settings = array('target_bundles' => array($vocabulary->id() => $vocabulary->id()), 'auto_create' => TRUE); $this->createEntityReferenceField('node', 'story', $name, NULL, 'taxonomy_term', 'default', $handler_settings, FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED); } $id_mappings = array('d6_vocabulary_field_instance' => array(array(array(1, 'page'), array('node', 'page', 'test'))), 'd6_vocabulary_entity_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_vocabulary_entity_form_display' => array(array(array(1, 'page'), array('node', 'page', 'default', 'test'))), 'd6_node' => array(array(array(1), array(1)), array(array(2), array(2)))); $this->prepareMigrations($id_mappings); $vids = array(1, 2, 3); for ($i = 1; $i <= 2; $i++) { $node = entity_create('node', array('type' => 'story', 'nid' => $i, 'vid' => array_shift($vids))); $node->enforceIsNew(); $node->save(); if ($i == 1) { $node->vid->value = array_shift($vids); $node->enforceIsNew(FALSE); $node->setNewRevision(); $node->isDefaultRevision(FALSE); $node->save(); } } $this->loadDumps(['Node.php', 'NodeRevisions.php', 'ContentTypeStory.php', 'ContentTypeTestPlanet.php', 'TermNode.php', 'TermHierarchy.php', 'TermData.php', 'Vocabulary.php', 'VocabularyNodeTypes.php']); }
/** * {@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(); // 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() . '/ProfileFields.php', $this->getDumpDirectory() . '/Users.php', $this->getDumpDirectory() . '/ProfileValues.php', $this->getDumpDirectory() . '/UsersRoles.php', $this->getDumpDirectory() . '/EventTimezones.php'); $this->loadDumps($dumps); $field_data = Database::getConnection('default', 'migrate')->select('profile_fields', 'u')->fields('u')->execute()->fetchAll(); // Create the field instances. foreach ($field_data as $field) { entity_create('field_config', array('label' => $field->title, 'description' => '', 'field_name' => $field->name, 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save(); } // Create our users for the node authors. $query = Database::getConnection('default', 'migrate')->query('SELECT * FROM {users} WHERE uid NOT IN (0, 1)'); while (($row = $query->fetchAssoc()) !== FALSE) { $user = entity_create('user', $row); $user->enforceIsNew(); $user->save(); } // 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(); $this->installConfig(['simpletest']); $this->loadDumps(['Variable.php']); $this->executeMigration('d6_simpletest_settings'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->loadDumps(['Variable.php']); $this->executeMigration('d6_user_mail'); $this->executeMigration('d6_user_settings'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installConfig(['comment']); $this->migrateContentTypes(); $this->executeMigrations(['d6_comment_type', 'd6_comment_field', 'd6_comment_field_instance']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('taxonomy_term'); $this->prepareMigrations(array('d6_taxonomy_vocabulary' => array(array(array(1), array('vocabulary_1_i_0_')), array(array(2), array('vocabulary_2_i_1_')), array(array(3), array('vocabulary_3_i_2_'))))); $this->executeMigration('d6_taxonomy_term'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('file'); $this->installSchema('file', ['file_usage']); // Create the user profile field and instance. entity_create('field_storage_config', array('entity_type' => 'user', 'field_name' => 'user_picture', 'type' => 'image', 'translatable' => '0'))->save(); entity_create('field_config', array('label' => 'User Picture', 'description' => '', 'field_name' => 'user_picture', 'entity_type' => 'user', 'bundle' => 'user', 'required' => 0))->save(); $file = entity_create('file', 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 = entity_create('file', 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(); // Load database dumps to provide source data. $dumps = array($this->getDumpDirectory() . '/Filters.php', $this->getDumpDirectory() . '/FilterFormats.php', $this->getDumpDirectory() . '/Variable.php', $this->getDumpDirectory() . '/ProfileFields.php', $this->getDumpDirectory() . '/Permission.php', $this->getDumpDirectory() . '/Role.php', $this->getDumpDirectory() . '/Users.php', $this->getDumpDirectory() . '/ProfileValues.php', $this->getDumpDirectory() . '/UsersRoles.php', $this->getDumpDirectory() . '/EventTimezones.php'); $this->loadDumps($dumps); $id_mappings = array('d6_user_role' => array(array(array(1), array('anonymous user')), array(array(2), array('authenticated user')), array(array(3), array('migrate test role 1')), array(array(4), array('migrate test role 2')), array(array(5), array('migrate test role 3'))), 'd6_user_picture_entity_display' => array(array(array(1), array('user', 'user', 'default', 'user_picture'))), 'd6_user_picture_entity_form_display' => array(array(array(1), array('user', 'user', 'default', 'user_picture'))), 'd6_user_picture_file' => array(array(array(2), array(2)), array(array(8), array(8)))); $this->prepareMigrations($id_mappings); // Migrate users. $migration = entity_load('migration', 'd6_user'); $executable = new MigrateExecutable($migration, $this); $executable->import(); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installSchema('node', ['node_access']); $this->migrateContent(TRUE); $this->migrateTaxonomy(); $this->executeMigrations(['d6_term_node:*', 'd6_term_node_revision:*']); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('node'); $this->installEntitySchema('comment'); $this->installConfig(['node', 'comment']); $this->executeMigration('d6_comment_type'); }
/** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->installEntitySchema('taxonomy_term'); $this->prepareMigrations(array('d6_taxonomy_vocabulary' => array(array(array(1), array('vocabulary_1_i_0_')), array(array(2), array('vocabulary_2_i_1_')), array(array(3), array('vocabulary_3_i_2_'))))); $this->loadDumps(['TermData.php', 'TermHierarchy.php', 'Vocabulary.php', 'VocabularyNodeTypes.php']); $this->executeMigration('d6_taxonomy_term'); }