Same name in other branches
  1. 8.x-1.x tests/src/Functional/EntityCloneEntityViewModeTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneEntityViewModeTest::testEntityViewModeEntityClone()

Test entity view mode entity clone.

File

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

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->drupalGet('entity_clone/entity_view_mode/' . $entity_view_mode->id());
    $this->submitForm($edit, $this->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.');
}