You are here

function ProfileTestWeights::testProfileFieldWeights in Drupal 7

File

modules/profile/profile.test, line 297
Tests for profile.module.

Class

ProfileTestWeights

Code

function testProfileFieldWeights() {
  $this
    ->drupalLogin($this->admin_user);
  $category = $this
    ->randomName();
  $field1 = $this
    ->createProfileField('textfield', $category, array(
    'weight' => 1,
  ));
  $field2 = $this
    ->createProfileField('textfield', $category, array(
    'weight' => -1,
  ));
  $this
    ->setProfileField($field1, $this
    ->randomName(8));
  $this
    ->setProfileField($field2, $this
    ->randomName(8));
  $profile_edit = $this
    ->drupalGet('user/' . $this->normal_user->uid . '/edit/' . $category);
  $this
    ->assertTrue(strpos($profile_edit, $field1['title']) > strpos($profile_edit, $field2['title']), 'Profile field weights are respected on the user edit form.');
  $profile_page = $this
    ->drupalGet('user/' . $this->normal_user->uid);
  $this
    ->assertTrue(strpos($profile_page, $field1['title']) > strpos($profile_page, $field2['title']), 'Profile field weights are respected on the user profile page.');
}