You are here

protected function MigrateFieldGroupTest::assertEntity in Field Group 8.3

Same name and namespace in other branches
  1. 8 contrib/field_group_migrate/tests/src/Kernel/Migrate/d7/MigrateFieldGroupTest.php \Drupal\Tests\field_group_migrate\Kernel\Migrate\d7\MigrateFieldGroupTest::assertEntity()

Asserts various aspects of a migrated field group.

Parameters

$id: The id of the entity display to which the field group applies.

$type: The destination type.

$group_name: The name of the field group.

$expected_label: The expected label.

int $expected_weight: The expected label.

array $expected_format_settings: The expected format settings.

string $expected_format_type: The expected format type.

array $expected_children: The expected children.

string $expected_parent_name: The expected parent name.

1 call to MigrateFieldGroupTest::assertEntity()
MigrateFieldGroupTest::testFieldGroup in contrib/field_group_migrate/tests/src/Kernel/Migrate/d7/MigrateFieldGroupTest.php
Test field group migration from Drupal 7 to 8.

File

contrib/field_group_migrate/tests/src/Kernel/Migrate/d7/MigrateFieldGroupTest.php, line 73

Class

MigrateFieldGroupTest
Tests field group migration.

Namespace

Drupal\Tests\field_group_migrate\Kernel\Migrate\d7

Code

protected function assertEntity($id, $type, $group_name, $expected_label, $expected_weight = 0, $expected_format_settings = [], $expected_format_type = 'tabs', $expected_children = [], $expected_parent_name = '') {

  /** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $entity */
  $entity = \Drupal::entityTypeManager()
    ->getStorage($type)
    ->load($id);
  $field_group_settings = $entity
    ->getThirdPartySettings('field_group');
  $this
    ->assertNotEmpty($field_group_settings);
  $this
    ->assertArrayHasKey($group_name, $field_group_settings);
  $field_group = $field_group_settings[$group_name];
  $this
    ->assertEquals($expected_label, $field_group['label']);
  $this
    ->assertEquals($expected_format_settings, $field_group['format_settings']);
  $this
    ->assertEquals($expected_children, $field_group['children']);
  $this
    ->assertEquals($expected_parent_name, $field_group['parent_name']);
  $this
    ->assertEquals($expected_weight, $field_group['weight']);
  $this
    ->assertEquals($expected_format_type, $field_group['format_type']);
}