You are here

public function ParagraphsFieldMigrationTest::testParagraphFormatters in Paragraphs 8

Test Paragraph Formatter Migration.

File

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

Class

ParagraphsFieldMigrationTest
Test the migration of paragraphs and field collection fields.

Namespace

Drupal\Tests\paragraphs\Kernel\migrate

Code

public function testParagraphFormatters() {
  $this
    ->executeMigrationWithDependencies('d7_field_formatter_settings');
  $full = EntityViewMode::load('paragraph.full');
  $this
    ->assertNotNull($full);
  $editor_preview = EntityViewMode::load('paragraph.paragraphs_editor_preview');
  $this
    ->assertNotNull($editor_preview);
  $viewDisplay = EntityViewDisplay::load('node.paragraphs_test.default');
  $this
    ->assertNotNull($viewDisplay);
  $field_any_paragraph = $viewDisplay
    ->getComponent('field_any_paragraph');
  $field_collection_test = $viewDisplay
    ->getComponent('field_field_collection_test');
  $field_paragraph_one_only = $viewDisplay
    ->getComponent('field_paragraph_one_only');
  $this
    ->assertNotNull($field_any_paragraph);
  $this
    ->assertNotNull($field_collection_test);
  $this
    ->assertEmpty($field_paragraph_one_only);
  $this
    ->assertEquals('paragraphs_editor_preview', $field_any_paragraph['settings']['view_mode']);
}