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