Same name and namespace in other branches
  1. 2.x tests/src/Functional/EntityCloneUserTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneUserTest::testUserEntityClone()

Test user entity clone.

Fichier

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

Classe

EntityCloneUserTest
Create a user and test a clone.

Namespace

Drupal\Tests\entity_clone\Functional

Code

public function testUserEntityClone() {
    $this->drupalGet('entity_clone/user/' . $this->adminUser
        ->id());
    $this->submitForm([], $this->t('Clone'));
    $users = \Drupal::entityTypeManager()->getStorage('user')
        ->loadByProperties([
        'name' => 'test_user_cloned',
    ]);
    $user = reset($users);
    $this->assertInstanceOf(User::class, $user, 'Test user cloned found in database.');
}