You are here

public function UserEditTestCase::testUserWith0Password in Drupal 7

Tests setting the password to "0".

File

modules/user/user.test, line 2217
Tests for user.module.

Class

UserEditTestCase
Tests editing a user account.

Code

public function testUserWith0Password() {
  $admin = $this
    ->drupalCreateUser(array(
    'administer users',
  ));
  $this
    ->drupalLogin($admin);

  // Create a regular user.
  $user1 = $this
    ->drupalCreateUser(array());
  $edit = array(
    'pass[pass1]' => '0',
    'pass[pass2]' => '0',
  );
  $this
    ->drupalPost("user/" . $user1->uid . "/edit", $edit, t('Save'));
  $this
    ->assertRaw(t("The changes have been saved."));
  $this
    ->drupalLogout();
  $user1->pass_raw = '0';
  $this
    ->drupalLogin($user1);
  $this
    ->drupalLogout();
}