comparison core/modules/user/tests/src/Kernel/UserSaveTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
1 <?php
2
3 namespace Drupal\Tests\user\Kernel;
4
5 use Drupal\KernelTests\KernelTestBase;
6 use Drupal\user\Entity\User;
7
8 /**
9 * Tests account saving for arbitrary new uid.
10 *
11 * @group user
12 */
13 class UserSaveTest extends KernelTestBase {
14
15 /**
16 * {@inheritdoc}
17 */
18 protected static $modules = [
19 'system',
20 'user',
21 ];
22
23 /**
24 * Ensures that an existing password is unset after the user was saved.
25 */
26 public function testExistingPasswordRemoval() {
27 $this->installSchema('system', ['sequences']);
28 $this->installEntitySchema('user');
29
30 /** @var \Drupal\user\Entity\User $user */
31 $user = User::create(['name' => $this->randomMachineName()]);
32 $user->save();
33 $user->setExistingPassword('existing password');
34 $this->assertNotNull($user->pass->existing);
35 $user->save();
36 $this->assertNull($user->pass->existing);
37 }
38
39 }