You are here

function UserRelationshipUserSettings::setUp in User Relationships 7

Set up the test case.

Overrides DrupalWebTestCase::setUp

File

user_relationships_ui/user_relationships_ui.test, line 26
User Relationships UI tests

Class

UserRelationshipUserSettings
Tests for user settings.

Code

function setUp() {
  parent::setUp(array(
    'user_relationships',
    'user_relationships_ui',
    'user_relationship_mailer',
  ));

  // Create relationship types.
  $rtype = new StdClass();
  $rtype->name = 'oneway';
  $rtype->machine_name = 'oneway';
  $rtype->plural_name = 'oneways';
  $rtype->is_oneway = TRUE;
  $rtype->requires_approval = FALSE;
  $rtype->expires_val = 0;
  user_relationships_type_save($rtype);
  $this->rtypes['oneway'] = $rtype;
  $rtype = new StdClass();
  $rtype->name = 'twoway';
  $rtype->machine_name = 'twoway';
  $rtype->plural_name = 'twoways';
  $rtype->is_oneway = FALSE;
  $rtype->requires_approval = FALSE;
  $rtype->expires_val = 0;
  user_relationships_type_save($rtype);
  $this->rtypes['twoway'] = $rtype;
  unset($rtype);
  $rtype = new StdClass();
  $rtype->name = 'approval';
  $rtype->machine_name = 'approval';
  $rtype->plural_name = 'approvals';
  $rtype->is_oneway = FALSE;
  $rtype->requires_approval = TRUE;
  $rtype->expires_val = 0;
  user_relationships_type_save($rtype);
  $this->rtypes['approval'] = $rtype;
  unset($rtype);
  $rtype = new StdClass();
  $rtype->name = 'approval-oneway';
  $rtype->machine_name = 'approval_oneway';
  $rtype->plural_name = 'approvals-oneway';
  $rtype->is_oneway = TRUE;
  $rtype->requires_approval = TRUE;
  $rtype->expires_val = 0;
  user_relationships_type_save($rtype);
  $this->rtypes['approval_oneway'] = $rtype;
  drupal_static_reset('user_relationships_types_load');

  // Allow users to auto approve relationships.
  variable_set('user_relationships_allow_auto_approve', TRUE);

  // Allow users to disable e-mail notifications.
  variable_set('user_relationship_mailer_send_mail', TRUE);

  // Flush permission cache.
  drupal_static_reset('user_relationships_types_load');
  $this
    ->checkPermissions(array(), TRUE);
}