You are here

public function ParagraphsFieldMigrationTest::testParagraphsWidgets in Paragraphs 8

Test Paragraph widget Migration.

File

tests/src/Kernel/migrate/ParagraphsFieldMigrationTest.php, line 100

Class

ParagraphsFieldMigrationTest
Test the migration of paragraphs and field collection fields.

Namespace

Drupal\Tests\paragraphs\Kernel\migrate

Code

public function testParagraphsWidgets() {
  $this
    ->executeMigrationWithDependencies('d7_field_instance_widget_settings');
  $formDisplay = EntityFormDisplay::load('node.paragraphs_test.default');
  $this
    ->assertNotNull($formDisplay);
  $field_any_paragraph = $formDisplay
    ->getComponent('field_any_paragraph');
  $field_collection_test = $formDisplay
    ->getComponent('field_field_collection_test');
  $field_paragraph_one_only = $formDisplay
    ->getComponent('field_paragraph_one_only');
  $this
    ->assertNotNull($field_any_paragraph);
  $this
    ->assertNotNull($field_collection_test);
  $this
    ->assertNotNull($field_paragraph_one_only);
  $this
    ->assertEquals('button', $field_any_paragraph['settings']['add_mode']);
  $this
    ->assertEquals('Any Paragraph', $field_any_paragraph['settings']['title']);
  $this
    ->assertEquals('Any Paragraphs', $field_any_paragraph['settings']['title_plural']);
  $this
    ->assertEquals('closed', $field_any_paragraph['settings']['edit_mode']);
}