/**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_user_picture_field');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('shortcut');
     // Make sure the 'default' shortcut_set is installed.
     $this->installConfig(['shortcut']);
 }
 /**
  * {@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() . '/Drupal6Node.php', $this->getDumpDirectory() . '/Drupal6Upload.php');
     $this->loadDumps($dumps);
 }
 /**
  * {@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() . '/Drupal6Node.php', $this->getDumpDirectory() . '/Drupal6TermNode.php', $this->getDumpDirectory() . '/Drupal6TaxonomyTerm.php', $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php');
     $this->loadDumps($dumps);
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('node');
     // Need at least one node type present.
     NodeType::create(['type' => 'testnodetype', 'name' => 'Test node type'])->save();
 }
 /**
  * {@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 tearDown()
 {
     // Move the results of every class under ours. This is solely for
     // reporting, the filename will guide developers.
     self::getDatabaseConnection()->update('simpletest')->fields(array('test_class' => get_class($this)))->condition('test_id', $this->testId)->execute();
     parent::tearDown();
 }
예제 #8
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_node_type');
     $dumps = array($this->getDumpDirectory() . '/Drupal6NodeType.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_system_cron');
     $dumps = array($this->getDumpDirectory() . '/Drupal6SystemCron.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_taxonomy_vocabulary');
     $dumps = array($this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@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);
     $migration = entity_load('migration', 'd6_user_picture_entity_form_display');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_user_mail');
     $dumps = array($this->getDumpDirectory() . '/Drupal6UserMail.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
예제 #13
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_view_modes');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FieldInstance.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_file_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FileSettings.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
예제 #15
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_filter_format');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FilterFormat.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_aggregator_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6AggregatorSettings.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $migration = entity_load('migration', 'd6_contact_category');
     $dumps = array($this->getDumpDirectory() . '/Drupal6ContactCategory.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
예제 #18
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->prepareMigrations(array('d6_taxonomy_vocabulary' => array(array(array(1), array('vocabulary_1_i_0_')))));
     $migration = entity_load('migration', 'd6_forum_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6ForumSettings.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_comment_type');
     $dumps = array($this->getDumpDirectory() . '/Drupal6CommentVariable.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_field');
     $dumps = array($this->getDumpDirectory() . '/Drupal6FieldInstance.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
예제 #21
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_date_formats');
     $dumps = array($this->getDumpDirectory() . '/Drupal6DateFormat.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $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_')))));
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_taxonomy_term');
     $dumps = array($this->getDumpDirectory() . '/Drupal6TaxonomyTerm.php', $this->getDumpDirectory() . '/Drupal6TaxonomyVocabulary.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->prepareMigrations(array('d6_filter_format' => array(array(array(2), array('full_html')))));
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_custom_block');
     $dumps = array($this->getDumpDirectory() . '/Drupal6Box.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     $dumps = array($this->getDumpDirectory() . '/Drupal6User.php');
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_user_picture_file');
     $migration->source['conf_path'] = 'core/modules/simpletest';
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     // Add some node mappings to get past checkRequirements().
     $id_mappings = array('d6_user_picture_field' => array(array(array('user_upload'), array('name', 'bundle'))));
     $this->prepareIdMappings($id_mappings);
     entity_create('field_storage_config', array('entity_type' => 'user', 'name' => 'user_picture', 'type' => 'image', 'translatable' => '0'))->save();
     $migration = entity_load('migration', 'd6_user_picture_field_instance');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $dumps = array($this->getDumpDirectory() . '/Drupal6User.php');
     $this->loadDumps($dumps);
     $id_mappings = array('d6_user' => array(array(array(2), array(2)), array(array(8), array(8)), array(array(15), array(15))));
     $this->prepareMigrations($id_mappings);
     // Migrate users.
     $migration = entity_load('migration', 'd6_user_contact_settings');
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Add some id mappings for the dependent migrations.
     $id_mappings = array('d6_contact_category' => array(array(array(1), array('website_feedback')), array(array(2), array('some_other_category'))));
     $this->prepareMigrations($id_mappings);
     $migration = entity_load('migration', 'd6_contact_settings');
     $dumps = array($this->getDumpDirectory() . '/Drupal6ContactSettings.php', $this->getDumpDirectory() . '/Drupal6ContactCategory.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, new MigrateMessage());
     $executable->import();
 }
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     // Add some id mappings for the dependant migrations.
     $id_mappings = array('d6_taxonomy_vocabulary' => array(array(array(4), array('tags'))));
     $this->prepareMigrations($id_mappings);
     entity_create('taxonomy_vocabulary', array('name' => 'Test Vocabulary', 'description' => 'Test Vocabulary', 'vid' => 'test_vocab'))->save();
     $migration = entity_load('migration', 'd6_vocabulary_field');
     $dumps = array($this->getDumpDirectory() . '/Drupal6VocabularyField.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
예제 #29
0
 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     parent::setUp();
     // We need some sample data so we can use the Migration process plugin.
     $id_mappings = array('d6_filter_format' => array(array(array(1), array('filtered_html')), array(array(2), array('full_html'))));
     $this->prepareIdMappings($id_mappings);
     /** @var \Drupal\migrate\entity\Migration $migration */
     $migration = entity_load('migration', 'd6_user_role');
     $dumps = array($this->getDumpDirectory() . '/Drupal6UserRole.php', $this->getDumpDirectory() . '/Drupal6FilterFormat.php');
     $this->prepare($migration, $dumps);
     $executable = new MigrateExecutable($migration, $this);
     $executable->import();
 }
예제 #30
0
 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     parent::setUp();
     $this->installEntitySchema('comment');
     $this->installEntitySchema('node');
     // Make sure uid 0 is created (default uid for comments is 0).
     $storage = \Drupal::entityManager()->getStorage('user');
     // Insert a row for the anonymous user.
     $storage->create(array('uid' => 0, 'status' => 0, 'name' => ''))->save();
     // Need at least one node type and comment type present.
     NodeType::create(['type' => 'testnodetype', 'name' => 'Test node type'])->save();
     CommentType::create(['id' => 'testcommenttype', 'label' => 'Test comment type', 'target_entity_type_id' => 'node'])->save();
 }