function MigrateFieldFormatterSettingsTest::testMigration

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldFormatterSettingsTest::testMigration()
  2. 10 core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldFormatterSettingsTest::testMigration()
  3. 11.x core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php \Drupal\Tests\field\Kernel\Migrate\d7\MigrateFieldFormatterSettingsTest::testMigration()

Tests migration of D7 field formatter settings.

File

core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php, line 89

Class

MigrateFieldFormatterSettingsTest
Tests migration of D7 field formatter settings.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

public function testMigration() {
    $this->assertEntity('comment.comment_node_article.default');
    $this->assertComponent('comment.comment_node_article.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertEntity('comment.comment_node_blog.default');
    $this->assertComponent('comment.comment_node_blog.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertEntity('comment.comment_node_book.default');
    $this->assertComponent('comment.comment_node_book.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertEntity('comment.comment_forum.default');
    $this->assertComponent('comment.comment_forum.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertEntity('comment.comment_node_page.default');
    $this->assertComponent('comment.comment_node_page.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertEntity('comment.comment_node_test_content_type.default');
    $this->assertComponent('comment.comment_node_test_content_type.default', 'comment_body', 'text_default', 'hidden', 0);
    $this->assertComponent('comment.comment_node_test_content_type.default', 'field_integer', 'number_integer', 'above', 1);
    $this->assertEntity('node.article.default');
    $this->assertComponent('node.article.default', 'body', 'text_default', 'hidden', 0);
    $this->assertComponent('node.article.default', 'field_tags', 'entity_reference_label', 'above', 10);
    $this->assertComponent('node.article.default', 'field_image', 'image', 'hidden', -1);
    $this->assertComponent('node.article.default', 'field_text_plain', 'string', 'above', 11);
    $this->assertComponent('node.article.default', 'field_text_filtered', 'text_default', 'above', 12);
    $this->assertComponent('node.article.default', 'field_text_long_plain', 'basic_string', 'above', 14);
    $this->assertComponent('node.article.default', 'field_text_long_filtered', 'text_default', 'above', 15);
    $this->assertComponent('node.article.default', 'field_text_sum_filtered', 'text_default', 'above', 18);
    $this->assertComponent('node.article.default', 'field_reference', 'entity_reference_label', 'above', 20);
    $this->assertComponent('node.article.default', 'field_reference_2', 'entity_reference_entity_view', 'above', 21);
    $this->assertEntity('node.article.teaser');
    $this->assertComponent('node.article.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 0);
    $this->assertComponent('node.article.teaser', 'field_tags', 'entity_reference_label', 'above', 10);
    $this->assertComponent('node.article.teaser', 'field_image', 'image', 'hidden', -1);
    $this->assertEntity('node.blog.default');
    $this->assertComponent('node.blog.default', 'body', 'text_default', 'hidden', 0);
    $this->assertEntity('node.blog.teaser');
    $this->assertComponent('node.blog.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 0);
    $this->assertComponent('node.blog.default', 'field_termplain', 'entity_reference_label', 'above', 13);
    $this->assertComponent('node.blog.default', 'field_termrss', 'entity_reference_label', 'above', 14);
    $this->assertEntity('node.book.default');
    $this->assertComponent('node.book.default', 'body', 'text_default', 'hidden', 0);
    $this->assertEntity('node.book.teaser');
    $this->assertComponent('node.book.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 0);
    $this->assertEntity('node.forum.default');
    $this->assertComponent('node.forum.default', 'body', 'text_default', 'hidden', 11);
    $this->assertComponent('node.forum.default', 'taxonomy_forums', 'entity_reference_label', 'above', 10);
    $this->assertEntity('node.forum.teaser');
    $this->assertComponent('node.forum.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 11);
    $this->assertComponent('node.forum.teaser', 'taxonomy_forums', 'entity_reference_label', 'above', 10);
    $this->assertEntity('node.page.default');
    $this->assertComponent('node.page.default', 'body', 'text_default', 'hidden', 0);
    $this->assertComponent('node.page.default', 'field_text_plain', 'string', 'above', 1);
    $this->assertComponent('node.page.default', 'field_text_filtered', 'text_default', 'above', 2);
    $this->assertComponent('node.page.default', 'field_text_long_plain', 'basic_string', 'above', 4);
    $this->assertComponent('node.page.default', 'field_text_long_filtered', 'text_default', 'above', 5);
    $this->assertComponent('node.page.default', 'field_text_sum_filtered', 'text_default', 'above', 8);
    $this->assertEntity('node.page.teaser');
    $this->assertComponent('node.page.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 0);
    $this->assertEntity('node.test_content_type.default');
    $this->assertComponent('node.test_content_type.default', 'field_boolean', 'list_default', 'above', 0);
    $this->assertComponent('node.test_content_type.default', 'field_email', 'email_mailto', 'above', 1);
    // Phone formatters are not mapped and should default to basic_string.
    $this->assertComponent('node.test_content_type.default', 'field_phone', 'basic_string', 'above', 2);
    $this->assertComponent('node.test_content_type.default', 'field_date', 'datetime_default', 'above', 3);
    $this->assertComponent('node.test_content_type.default', 'field_date_with_end_time', 'datetime_default', 'above', 4);
    $this->assertComponent('node.test_content_type.default', 'field_file', 'file_default', 'above', 5);
    $this->assertComponent('node.test_content_type.default', 'field_float', 'number_decimal', 'above', 6);
    $this->assertComponent('node.test_content_type.default', 'field_images', 'image', 'above', 7);
    $this->assertComponent('node.test_content_type.default', 'field_integer', 'number_integer', 'above', 8);
    $this->assertComponent('node.test_content_type.default', 'field_link', 'link', 'above', 9);
    $this->assertComponent('node.test_content_type.default', 'field_text_list', 'list_default', 'above', 10);
    $this->assertComponent('node.test_content_type.default', 'field_integer_list', 'list_default', 'above', 11);
    $this->assertComponent('node.test_content_type.default', 'field_float_list', 'list_default', 'above', 19);
    $this->assertComponent('node.test_content_type.default', 'field_long_text', 'text_default', 'above', 12);
    $this->assertComponent('node.test_content_type.default', 'field_node_entityreference', 'entity_reference_label', 'above', 15);
    $this->assertComponent('node.test_content_type.default', 'field_user_entityreference', 'entity_reference_label', 'above', 16);
    $this->assertComponent('node.test_content_type.default', 'field_term_entityreference', 'entity_reference_label', 'above', 17);
    $this->assertComponentNotExists('node.test_content_type.default', 'field_term_reference');
    $this->assertComponentNotExists('node.test_content_type.default', 'field_text');
    $this->assertEntity('user.user.default');
    $this->assertComponent('user.user.default', 'field_file', 'file_default', 'above', 0);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.