You are here

public function RollbackFieldInstanceTest::testFieldInstances in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/field/tests/src/Kernel/Migrate/d7/RollbackFieldInstanceTest.php \Drupal\Tests\field\Kernel\Migrate\d7\RollbackFieldInstanceTest::testFieldInstances()

Tests migrating D7 fields to field_storage_config entities, then rolling back.

Overrides MigrateFieldInstanceTest::testFieldInstances

File

core/modules/field/tests/src/Kernel/Migrate/d7/RollbackFieldInstanceTest.php, line 18

Class

RollbackFieldInstanceTest
Migrates and rolls back Drupal 7 fields.

Namespace

Drupal\Tests\field\Kernel\Migrate\d7

Code

public function testFieldInstances() {

  // Test that the field instances have migrated (prior to rollback).
  parent::testFieldInstances();
  $this
    ->executeRollback('d7_field_instance');
  $this
    ->executeRollback('d7_field');

  // Check that field instances have been rolled back.
  $field_instance_ids = [
    'comment.comment_node_page.comment_body',
    'node.page.body',
    'comment.comment_node_article.comment_body',
    'node.article.body',
    'node.article.field_tags',
    'node.article.field_image',
    'comment.comment_node_blog.comment_body',
    'node.blog.body',
    'comment.comment_node_book.comment_body',
    'node.book.body',
    'node.forum.taxonomy_forums',
    'comment.comment_forum.comment_body',
    'node.forum.body',
    'comment.comment_node_test_content_type.comment_body',
    'node.test_content_type.field_boolean',
    'node.test_content_type.field_email',
    'node.test_content_type.field_phone',
    'node.test_content_type.field_date',
    'node.test_content_type.field_date_with_end_time',
    'node.test_content_type.field_file',
    'node.test_content_type.field_float',
    'node.test_content_type.field_images',
    'node.test_content_type.field_integer',
    'node.test_content_type.field_link',
    'node.test_content_type.field_text_list',
    'node.test_content_type.field_integer_list',
    'node.test_content_type.field_long_text',
    'node.test_content_type.field_term_reference',
    'node.test_content_type.field_text',
    'comment.comment_node_test_content_type.field_integer',
    'user.user.field_file',
  ];
  foreach ($field_instance_ids as $field_instance_id) {
    $this
      ->assertNull(FieldConfig::load($field_instance_id));
  }
}