protected function MigrateUserAdminPassTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php \Drupal\Tests\user\Kernel\Migrate\MigrateUserAdminPassTest::setUp()
- 10 core/modules/user/tests/src/Kernel/Migrate/MigrateUserAdminPassTest.php \Drupal\Tests\user\Kernel\Migrate\MigrateUserAdminPassTest::setUp()
Overrides MigrateTestBase::setUp
File
- core/
modules/ user/ tests/ src/ Kernel/ Migrate/ MigrateUserAdminPassTest.php, line 32
Class
- MigrateUserAdminPassTest
- Tests preservation of root account password.
Namespace
Drupal\Tests\user\Kernel\MigrateCode
protected function setUp() : void {
parent::setUp();
// Make sure the admin user and a regular user are created.
$this->container
->get('module_handler')
->loadInclude('user', 'install');
$this
->installEntitySchema('user');
user_install();
/** @var \Drupal\user\Entity\User $admin_account */
$admin_account = User::load(1);
$admin_account
->setPassword('original');
$admin_account
->save();
$this->originalPasswords[1] = $admin_account
->getPassword();
/** @var \Drupal\user\Entity\User $user_account */
$user_account = User::create([
'uid' => 2,
'name' => 'original_username',
'mail' => 'original_email@example.com',
'pass' => 'original_password',
]);
$user_account
->save();
$this->originalPasswords[2] = $user_account
->getPassword();
}