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

Test entity form mode entity clone.

File

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

Class

EntityCloneEntityFormModeTest
Test an entity form mode clone.

Namespace

Drupal\Tests\entity_clone\Functional

Code

public function testEntityFormModeEntityClone() {
    $entity_form_modes = \Drupal::entityTypeManager()->getStorage('entity_form_mode')
        ->loadByProperties([
        'id' => 'user.register',
    ]);
    $entity_form_mode = reset($entity_form_modes);
    $edit = [
        'label' => 'User register cloned form mode',
        'id' => 'register_clone',
    ];
    $this->drupalGet('entity_clone/entity_form_mode/' . $entity_form_mode->id());
    $this->submitForm($edit, $this->t('Clone'));
    $entity_form_modes = \Drupal::entityTypeManager()->getStorage('entity_form_mode')
        ->loadByProperties([
        'id' => 'user.' . $edit['id'],
    ]);
    $entity_form_mode = reset($entity_form_modes);
    $this->assertInstanceOf(EntityFormMode::class, $entity_form_mode, 'Test entity form mode cloned found in database.');
}