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

Test user entity clone.

File

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

Class

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.');
}