You are here

function Profile2CRUDTestCase::testRegistrationIntegration in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.test \Profile2CRUDTestCase::testRegistrationIntegration()

Test registration integration.

File

./profile2.test, line 94

Class

Profile2CRUDTestCase
Test basic CRUD functionality.

Code

function testRegistrationIntegration() {

  // Allow registration by site visitors without administrator approval.
  variable_set('user_register', 1);
  $edit = array();
  $edit['name'] = $name = $this
    ->randomName();
  $edit['mail'] = $mail = $edit['name'] . '@example.com';
  $edit['profile_main[profile_fullname][und][0][value]'] = $this
    ->randomName();
  $this
    ->drupalPost('user/register', $edit, t('Create new account'));
  $this
    ->assertText(t('A welcome message with further instructions has been sent to your e-mail address.'), t('User registered successfully.'));
  $return = user_load_multiple(array(), array(
    'name' => $name,
    'mail' => $mail,
  ));
  $new_user = reset($return);
  $this
    ->assertTrue($new_user->status, t('New account is active after registration.'));
  $this
    ->assertEqual(profile2_load_by_user($new_user, 'main')->profile_fullname[LANGUAGE_NONE][0]['value'], $edit['profile_main[profile_fullname][und][0][value]'], 'Profile created.');
}