migrateFields example

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

    $this->fileMigrationSetup();

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

    $this->migrateFields();
    $this->migrateUsers();
    $this->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_taxonomy_vocabulary',
    ]);
  }

  /** * {@inheritdoc} */
  
'telephone',
    'text',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['node']);
    $this->executeMigration('language');
    $this->migrateFields();
    $this->executeMigrations([
      'd7_field_option_translation',
      'd7_field_instance_option_translation',
    ]);
  }

  /** * Migrate field instance option translations. */
  public function testFieldInstanceOptionTranslation() {
    $language_manager = $this->container->get('language_manager');

    

  protected static $modules = ['comment', 'menu_ui'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['comment']);
    $this->executeMigration('d6_comment_type');
    $this->migrateFields();
  }

  /** * Tests that migrated view modes can be loaded using D8 API's. */
  public function testWidgetSettings() {
    // Test the config can be loaded.     $form_display = EntityFormDisplay::load('node.story.default');
    $this->assertNotNull($form_display);

    // Text field.
// 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');
  }

}

  protected $treeData = [];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installEntitySchema('comment');
    $this->installEntitySchema('file');
    $this->installEntitySchema('taxonomy_term');
    $this->migrateFields();

    $this->executeMigrations([
      'language',
      'd7_language_content_taxonomy_vocabulary_settings',
      'd7_taxonomy_vocabulary',
      'd7_taxonomy_term',
      'd7_entity_translation_settings',
      'd7_taxonomy_term_entity_translation',
      'd7_taxonomy_term_localized_translation',
      'd7_taxonomy_term_translation',
    ]);
  }

  protected static $modules = ['comment', 'menu_ui', 'node'];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->installConfig(['comment']);
    $this->executeMigration('d6_comment_type');
    $this->migrateFields();
  }

  /** * Asserts that a particular component is NOT included in a display. * * @param string $display_id * The display ID. * @param string $component_id * The component ID. * * @internal */

      ],
    ];
  }

  /** * Tests the addFields method. * * @covers ::addAllFieldProcesses */
  public function testAddFields() {
    $this->migrateFields();
    $field_discovery = $this->container->get('migrate_drupal.field_discovery');
    $migration_plugin_manager = $this->container->get('plugin.manager.migration');
    $definition = [
      'migration_tags' => ['Drupal 6'],
    ];
    $migration = $migration_plugin_manager->createStubMigration($definition);
    $field_discovery->addBundleFieldProcesses($migration, 'node', 'test_planet');
    $actual_process = $migration->getProcess();
    $expected_process = [
      'field_multivalue' => [
        0 => [
          
'language',
    'menu_ui',
    'node',
    'field',
  ];

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->migrateFields();

    $this->installEntitySchema('node');
    $this->installConfig(['node']);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('system', ['sequences']);
    $this->executeMigration('language');
    $this->executeMigration('d6_field_instance_label_description_translation');
  }

  /** * {@inheritdoc} */
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')
      ->getStorage('node');
  }
if ($include_revisions) {
      $this->executeMigrations(['d7_node_revision']);
    }
  }

  /** * Executes all taxonomy term migrations. */
  protected function migrateTaxonomyTerms() {
    $this->installEntitySchema('taxonomy_term');
    $this->migrateFields();
    // Uses executeMigrations() rather than executeMigration() because the     // former includes all of the migration derivatives, e.g.     // d7_taxonomy_term:tags.     $this->executeMigrations(['d7_taxonomy_term']);
  }

}
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() {
    $this->container->get('entity_type.manager')
      
protected function setUp(): void {
    parent::setUp();

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

    $this->executeMigration('language');
    $this->executeMigration('d6_node_settings');
    $this->migrateUsers(FALSE);
    $this->migrateFields();
    $this->migrateTaxonomy();
    $this->migrateContent(['translations']);

    // This is a base plugin id and we want to run all derivatives.     $this->executeMigrations([
      'd6_term_node',
      'd6_term_node_translation',
    ]);
  }

  /** * Tests the Drupal 6 term-node association to Drupal 8 migration. */
$this->installSchema('comment', ['comment_entity_statistics']);
    $this->installSchema('node', ['node_access']);
    $this->installSchema('system', ['sequences']);

    $this->createContent();

    $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
    $this->nodeStorage->delete($this->nodeStorage->loadMultiple());

    $this->migrateUsers();
    $this->migrateFields();
    $this->executeMigrations([
      'language',
      'd7_language_content_settings',
      'd7_comment_field',
      'd7_comment_field_instance',
      'd7_node_complete',
    ]);
    $this->nodeStorage = $this->container->get('entity_type.manager')
      ->getStorage('node');
  }

  
class MigrateFieldInstanceTest extends MigrateDrupal6TestBase {

  /** * {@inheritdoc} */
  protected static $modules = ['comment', 'menu_ui', 'node'];

  /** * Tests migration of file variables to file.settings.yml. */
  public function testFieldInstanceMigration() {
    $this->migrateFields();
    $this->installConfig(['comment']);
    $this->executeMigration('d6_comment_type');

    $entity = Node::create(['type' => 'story']);
    // Test a text field.     /** @var \Drupal\field\FieldConfigInterface $field */
    $field = FieldConfig::load('node.story.field_test');
    $this->assertSame('Text Field', $field->label());
    // field_test is a text_long field, which have no settings.     $this->assertSame(['allowed_formats' => []]$field->getSettings());
    $this->assertSame('text for default value', $entity->field_test->value);

    
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',
      'd7_node_translation',
      
Home | Imprint | This part of the site doesn't use cookies.