function UserRelationshipsApiTestCase::setUp in User Relationships 6
Enable modules.
Overrides DrupalWebTestCase::setUp
File
- user_relationships_api/
tests/ user_relationships_api.api.test, line 28 - User Relationships API testcase @author Alex Karshakevich http://drupal.org/user/183217
Class
- UserRelationshipsApiTestCase
- @file User Relationships 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;
//#348025 reciprocal one-way relationships
unset($rtype);
$rtype = new StdClass();
$rtype->name = 'approval-reciprocal';
$rtype->plural_name = 'approvals-reciprocal';
$rtype->is_oneway = TRUE;
$rtype->is_reciprocal = TRUE;
$rtype->requires_approval = TRUE;
$rtype->expires_val = 0;
user_relationships_type_save($rtype);
$this->rtypes['approval-reciprocal'] = $rtype;
user_relationships_types_load(TRUE);
}