public function MigrateFieldGroupTest::testFieldGroup in Field Group 8
Same name and namespace in other branches
- 8.3 contrib/field_group_migrate/tests/src/Kernel/Migrate/d7/MigrateFieldGroupTest.php \Drupal\Tests\field_group_migrate\Kernel\Migrate\d7\MigrateFieldGroupTest::testFieldGroup()
Test field group migration from Drupal 7 to 8.
File
- contrib/
field_group_migrate/ tests/ src/ Kernel/ Migrate/ d7/ MigrateFieldGroupTest.php, line 96
Class
- MigrateFieldGroupTest
- Tests field group migration.
Namespace
Drupal\Tests\field_group_migrate\Kernel\Migrate\d7Code
public function testFieldGroup() {
$this
->assertEntity('node.page.default', 'entity_view_display', 'group_page', 'Node group', 0, [
'direction' => 'horizontal',
]);
$this
->assertEntity('user.user.default', 'entity_view_display', 'group_user', 'User group parent', 1, [
'element' => 'div',
], 'html_element');
$this
->assertEntity('user.user.default', 'entity_view_display', 'group_user_child', 'User group child', 99, [
'direction' => 'vertical',
'label' => 'User group child',
'classes' => 'user-group-child',
'id' => 'group_article_node_article_teaser',
], 'tabs', [
'user_picture',
], 'group_user');
$this
->assertEntity('node.article.teaser', 'entity_view_display', 'group_article', 'htab group', 2, [
'classes' => 'htab-group',
], 'tab', [
'field_image',
]);
// Check an entity_view_display without a field group.
/** @var \Drupal\Core\Entity\Display\EntityDisplayInterface $entity */
$entity = \Drupal::entityTypeManager()
->getStorage('entity_view_display')
->load('node.page.teaser');
$field_group_settings = $entity
->getThirdPartySettings('field_group');
$this
->assertEmpty($field_group_settings);
$this
->assertEntity('node.page.default', 'entity_form_display', 'group_page', 'Node form group', 0, [
'direction' => 'horizontal',
]);
$this
->assertEntity('node.article.default', 'entity_form_display', 'group_article', 'htab form group', 2, [], 'tab', [
'field_image',
]);
// Check an entity_form_display without a field group.
$entity = \Drupal::entityTypeManager()
->getStorage('entity_form_display')
->load('node.blog.default');
$field_group_settings = $entity
->getThirdPartySettings('field_group');
$this
->assertEmpty($field_group_settings);
}