1 user.test public UserEditTestCase::testUserWith0Password()

Tests setting the password to "0".

At one point it was found that logging in with a password that is literally "0" was not possible. This test prevents regression of this behavior.

File

core/modules/user/tests/user.test, line 1929
Tests for user.module.

Class

UserEditTestCase
Test case to test user_save() behavior.

Code

public function testUserWith0Password() {
  $admin = $this->backdropCreateUser(array('administer users'));
  $this->backdropLogin($admin);
  // Create a regular user.
  $user1 = $this->backdropCreateUser(array());
  // Disable strong password required.
  config_set('system.core', 'user_password_reject_weak', FALSE);

  $edit = array('pass' => '0');
  $this->backdropPost("user/" . $user1->uid . "/edit", $edit, t('Save'));
  $this->assertRaw(t("The changes have been saved."));

  $this->backdropLogout();
  $user1->pass_raw = '0';
  $this->backdropLogin($user1);
  $this->backdropLogout();
}