You are here

public function FieldFormatterSettingsTest::testMigration in Commerce Migrate 3.1.x

Same name and namespace in other branches
  1. 8.2 modules/commerce/tests/src/Kernel/Migrate/commerce1/FieldFormatterSettingsTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\FieldFormatterSettingsTest::testMigration()
  2. 3.0.x modules/commerce/tests/src/Kernel/Migrate/commerce1/FieldFormatterSettingsTest.php \Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1\FieldFormatterSettingsTest::testMigration()

Tests migration of D7 field formatter settings.

File

modules/commerce/tests/src/Kernel/Migrate/commerce1/FieldFormatterSettingsTest.php, line 107

Class

FieldFormatterSettingsTest
Tests field formatter settings migration.

Namespace

Drupal\Tests\commerce_migrate_commerce\Kernel\Migrate\commerce1

Code

public function testMigration() {
  $this
    ->assertEntity('comment.comment_node_ad_push.default');
  $this
    ->assertEntity('comment.comment_node_bags_cases.default');
  $this
    ->assertEntity('comment.comment_node_blog_post.default');
  $this
    ->assertEntity('comment.comment_node_drinks.default');
  $this
    ->assertEntity('comment.comment_node_hats.default');
  $this
    ->assertEntity('comment.comment_node_page.default');
  $this
    ->assertEntity('comment.comment_node_shoes.default');
  $this
    ->assertEntity('comment.comment_node_slideshow.default');
  $this
    ->assertEntity('comment.comment_node_storage_devices.default');
  $this
    ->assertEntity('comment.comment_node_tops.default');
  $this
    ->assertEntity('commerce_product.bags_cases.default');
  $this
    ->assertComponent('commerce_product.bags_cases.default', 'body', 'text_default', 'hidden', 4);
  $this
    ->assertComponent('commerce_product.bags_cases.default', 'variations', 'commerce_add_to_cart', 'above', 10);
  $this
    ->assertEntity('commerce_product.drinks.default');
  $this
    ->assertEntity('commerce_product.hats.default');
  $this
    ->assertEntity('commerce_product.shoes.default');
  $this
    ->assertEntity('commerce_product.storage_devices.default');
  $this
    ->assertEntity('commerce_product.tops.default');
  $this
    ->assertEntity('commerce_product_variation.bags_cases.default');
  $this
    ->assertEntity('commerce_product_variation.drinks.default');
  $this
    ->assertComponent('commerce_product_variation.drinks.default', 'field_images', 'image', 'above', 1);
  $this
    ->assertComponent('commerce_product_variation.drinks.default', 'price', 'commerce_price_default', 'above', 0);
  $this
    ->assertEntity('commerce_product_variation.hats.default');
  $this
    ->assertEntity('commerce_product_variation.shoes.default');
  $this
    ->assertEntity('commerce_product_variation.storage_devices.default');
  $this
    ->assertEntity('commerce_product_variation.tops.default');
  $this
    ->assertEntity('node.ad_push.default');
  $this
    ->assertEntity('node.ad_push.teaser');

  // Tests node formatter settings.
  $this
    ->assertEntity('node.ad_push.default');
  $this
    ->assertComponent('node.ad_push.default', 'field_image', 'image', 'hidden', -1);
  $this
    ->assertComponent('node.ad_push.default', 'field_link', 'link', 'above', 2);
  $this
    ->assertComponent('node.ad_push.default', 'field_tagline', 'string', 'above', 3);
  $this
    ->assertEntity('node.ad_push.teaser');
  $this
    ->assertEntity('node.bags_cases.default');
  $this
    ->assertEntity('node.bags_cases.teaser');
  $this
    ->assertEntity('node.blog_post.default');
  $this
    ->assertComponent('node.blog_post.default', 'body', 'text_default', 'hidden', 1);
  $this
    ->assertEntity('node.blog_post.teaser');
  $this
    ->assertComponent('node.blog_post.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 1);

  // @todo The product_list view is missing for all products.
  // https://www.drupal.org/project/commerce_migrate/issues/2927330
  $this
    ->assertEntity('node.drinks.default');
  $this
    ->assertEntity('node.drinks.teaser');
  $this
    ->assertEntity('node.hats.default');
  $this
    ->assertEntity('node.hats.teaser');
  $this
    ->assertEntity('node.page.default');
  $this
    ->assertComponent('node.page.default', 'body', 'text_default', 'hidden', 0);
  $this
    ->assertEntity('node.page.teaser');
  $this
    ->assertComponent('node.page.teaser', 'body', 'text_summary_or_trimmed', 'hidden', 0);
  $this
    ->assertEntity('node.shoes.default');
  $this
    ->assertEntity('node.shoes.teaser');
  $this
    ->assertEntity('node.slideshow.default');
  $this
    ->assertEntity('node.slideshow.teaser');
  $this
    ->assertEntity('node.storage_devices.default');
  $this
    ->assertEntity('node.storage_devices.teaser');
  $this
    ->assertEntity('node.tops.default');
  $this
    ->assertEntity('node.tops.teaser');

  // Tests node formatter settings.
  $this
    ->assertEntity('taxonomy_term.category.default');
  $this
    ->assertEntity('taxonomy_term.collection.default');

  // Test there are no errors in the map table.
  $migration = $this
    ->getMigration('d7_field_formatter_settings');
  $errors = $migration
    ->getIdMap()
    ->errorCount();
  $this
    ->assertSame(0, $errors);
}