Commit 3e77ea2d authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2675470 by Jo Fitzgerald, hussainweb: D7 field instance settings for...

Issue #2675470 by Jo Fitzgerald, hussainweb: D7 field instance settings for any fields not on nodes are not migrating

(cherry picked from commit 35a5e6bc)
parent 58de4e79
Loading
Loading
Loading
Loading
+1 −2
Changes for core/modules/field/src/Plugin/migrate/source/d7/FieldInstancePerFormDisplay.php: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -28,8 +28,7 @@ public function query() {
      ->fields('fc', array(
        'type',
        'module',
      ))
      ->condition('fci.entity_type', 'node');
      ));
    $query->join('field_config', 'fc', 'fci.field_id = fc.id');
    return $query;
  }
+3 −0
Changes for core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
use Drupal\Core\Database\Database;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\node\Entity\NodeType;

@@ -88,6 +89,8 @@ protected function setUp() {
      'label' => $this->randomMachineName(),
    ])->save();

    Vocabulary::create(['vid' => 'test_vocabulary'])->save();

    // Give one unfortunate field instance invalid display settings to ensure
    // that the migration provides an empty array as a default (thus avoiding
    // an "unsupported operand types" fatal).
+2 −0
Changes for core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceTest.php: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@
use Drupal\comment\Entity\CommentType;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\FieldConfigInterface;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\node\Entity\NodeType;

@@ -45,6 +46,7 @@ protected function setUp() {
    $this->createType('book');
    $this->createType('forum');
    $this->createType('test_content_type');
    Vocabulary::create(['vid' => 'test_vocabulary'])->save();
    $this->executeMigrations(['d7_field', 'd7_field_instance']);
  }

+11 −0
Changes for core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldInstanceWidgetSettingsTest.php: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ protected function setUp() {
    $this->executeMigrations([
      'd7_node_type',
      'd7_comment_type',
      'd7_taxonomy_vocabulary',
      'd7_field',
      'd7_field_instance',
      'd7_field_instance_widget_settings',
@@ -126,6 +127,16 @@ public function testWidgetSettings() {
    $this->assertComponent('node.test_content_type.default', 'field_term_reference', 'entity_reference_autocomplete', 14);
    $this->assertComponent('node.test_content_type.default', 'field_text', 'text_textfield', 15);
    $this->assertComponent('node.test_content_type.default', 'field_text_list', 'options_select', 11);

    $this->assertEntity('user.user.default', 'user', 'user');
    $this->assertComponent('user.user.default', 'field_file', 'file_generic', 8);

    $this->assertEntity('comment.comment_node_test_content_type.default', 'comment', 'comment_node_test_content_type');
    $this->assertComponent('comment.comment_node_test_content_type.default', 'comment_body', 'text_textarea', 0);
    $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number', 2);

    $this->assertEntity('taxonomy_term.test_vocabulary.default', 'taxonomy_term', 'test_vocabulary');
    $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number', 2);
  }

}
+1 −1
Changes for core/modules/field/tests/src/Kernel/Migrate/d7/MigrateViewModesTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
 */
class MigrateViewModesTest extends MigrateDrupal7TestBase {

  public static $modules = ['comment', 'node'];
  public static $modules = ['comment', 'node', 'taxonomy'];

  /**
   * {@inheritdoc}
Loading