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

Test shortcut set entity clone.

Fichier

tests/src/Functional/EntityCloneShortcutSetTest.php, line 62

Classe

EntityCloneShortcutSetTest
Create a shortcut set and test a clone.

Namespace

Drupal\Tests\entity_clone\Functional

Code

public function testShortcutSetEntityClone() {
    $edit = [
        'id' => 'test_shortcut_set_cloned',
        'label' => 'Test shortcut set cloned',
    ];
    $this->drupalGet('entity_clone/shortcut_set/default');
    $this->submitForm($edit, $this->t('Clone'));
    $shortcut_sets = \Drupal::entityTypeManager()->getStorage('shortcut_set')
        ->loadByProperties([
        'id' => $edit['id'],
    ]);
    $shortcut_set = reset($shortcut_sets);
    $this->assertInstanceOf(ShortcutSet::class, $shortcut_set, 'Test default shortcut set cloned found in database.');
}