You are here

public function EntityCloneEntityViewModeTest::testEntityViewModeEntityClone in Entity Clone 8

Test entity view mode entity clone.

File

tests/src/Functional/EntityCloneEntityViewModeTest.php, line 59

Class

EntityCloneEntityViewModeTest
Test an entity view mode clone.

Namespace

Drupal\Tests\entity_clone\Functional

Code

public function testEntityViewModeEntityClone() {
  $entity_view_modes = \Drupal::entityTypeManager()
    ->getStorage('entity_view_mode')
    ->loadByProperties([
    'id' => 'user.full',
  ]);
  $entity_view_mode = reset($entity_view_modes);
  $edit = [
    'label' => 'User full cloned view mode',
    'id' => 'register_clone',
  ];
  $this
    ->drupalPostForm('entity_clone/entity_view_mode/' . $entity_view_mode
    ->id(), $edit, t('Clone'));
  $entity_view_modes = \Drupal::entityTypeManager()
    ->getStorage('entity_view_mode')
    ->loadByProperties([
    'id' => 'user.' . $edit['id'],
  ]);
  $entity_view_mode = reset($entity_view_modes);
  $this
    ->assertInstanceOf(EntityViewMode::class, $entity_view_mode, 'Test entity view mode cloned found in database.');
}