You are here

function UserRelationshipsApiSocnetTestCase::setUp in User Relationships 6

Enable modules.

Overrides DrupalWebTestCase::setUp

File

user_relationships_api/tests/user_relationships_api.socnet.test, line 29
Social networking hook API testcase @author Alex Karshakevich http://drupal.org/user/183217

Class

UserRelationshipsApiSocnetTestCase
@file Social networking hook API testcase @author Alex Karshakevich http://drupal.org/user/183217

Code

function setUp() {
  parent::setUp('user_relationships_api');
  $this->users = array();
  $this->rtypes = array();

  //important, reset cache of rel types between runs
  user_relationships_types_load(TRUE);

  //create test users

  //    $user = $this->drupalCreateUser();
  //    $users[$user->uid] = $user;
  //    $user = $this->drupalCreateUser();
  //    $users[$user->uid] = $user;
  //    $user = $this->drupalCreateUser();
  //    $users[$user->uid] = $user;

  //create relationships
  $rtype = new StdClass();
  $rtype->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;
  unset($rtype);
  $rtype = new StdClass();
  $rtype->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->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->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;
  user_relationships_types_load(TRUE);
}