Same name in other branches
- 8.x-1.x tests/src/Functional/EntityCloneUserTest.php \Drupal\Tests\entity_clone\Functional\EntityCloneUserTest
Create a user and test a clone.
@group entity_clone
Hierarchy
- class \Drupal\Tests\entity_clone\Functional\EntityCloneUserTest extends \Drupal\Tests\BrowserTestBase uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of EntityCloneUserTest
File
-
tests/
src/ Functional/ EntityCloneUserTest.php, line 14
Namespace
Drupal\Tests\entity_clone\FunctionalView source
class EntityCloneUserTest extends BrowserTestBase {
use StringTranslationTrait;
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'entity_clone',
'user',
];
/**
* Theme to enable by default.
*
* @var string
*/
protected $defaultTheme = 'claro';
/**
* Permissions to grant admin user.
*
* @var array
*/
protected $permissions = [
'clone user entity',
'administer users',
];
/**
* An administrative user with permission to configure users settings.
*
* @var \Drupal\user\UserInterface
*/
protected $adminUser;
/**
* Sets the test up.
*/
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this->drupalCreateUser($this->permissions, 'test_user');
$this->drupalLogin($this->adminUser);
}
/**
* Test user entity clone.
*/
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.');
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
EntityCloneUserTest::$adminUser | protected | property | An administrative user with permission to configure users settings. |
EntityCloneUserTest::$defaultTheme | protected | property | Theme to enable by default. |
EntityCloneUserTest::$modules | protected static | property | Modules to enable. |
EntityCloneUserTest::$permissions | protected | property | Permissions to grant admin user. |
EntityCloneUserTest::setUp | protected | function | Sets the test up. |
EntityCloneUserTest::testUserEntityClone | public | function | Test user entity clone. |