You are here

user_registrationpassword_user_register_form.test in User registration password 7

Functionality tests for user_registrationpassword.module: pass reset form.

File

tests/user_registrationpassword_user_register_form.test
View source
<?php

/**
 * @file
 * Functionality tests for user_registrationpassword.module: pass reset form.
 */

/**
 * Class UserRegistrationPasswordUserRegisterFormTestCase.
 */
class UserRegistrationPasswordUserRegisterFormTestCase extends DrupalWebTestCase {
  protected $profile = 'standard';

  /**
   * Implements getInfo().
   */
  public static function getInfo() {
    return array(
      'name' => t('User register form test'),
      'description' => t('Test the user register form with user_registrationpassword enabled.'),
      'group' => t('User Registration Password'),
    );
  }

  /**
   * Implements setUp().
   */
  public function setUp($modules = array()) {
    $modules[] = 'user_registrationpassword';
    parent::setUp($modules);
    variable_set('user_register', USER_REGISTER_VISITORS);
    global $user;
    $user->uid = 0;

    // Load form.
    $this->register_form = drupal_get_form('user_register_form');
  }

  /**
   * Implements testUserRegisterFormDefaultValues().
   */
  public function testUserRegisterFormDefaultValues() {

    // Test values.
    $this
      ->assertTrue(is_int($this->register_form['account']['status']['#default_value']), 'The default value for status is an integer.');
    $this
      ->assertTrue(is_bool($this->register_form['account']['notify']['#default_value']), 'The default value for notify is a boolean.');
  }

  /**
   * Implements testUserRegisterFormCompatibility().
   */
  public function testUserRegisterFormCompatibility() {

    // Test submit callback.
    $this
      ->assertEqual($this->register_form['#submit'][1], 'user_registrationpassword_form_user_register_submit', 'Submit handler correctly changed.');
  }

}

Classes

Namesort descending Description
UserRegistrationPasswordUserRegisterFormTestCase Class UserRegistrationPasswordUserRegisterFormTestCase.