You are here

function UserRelationshipsTestCase::testNoOnewayRelationships in User Relationships 7

Test the load functions if there are no one way relationship types.

File

./user_relationships.test, line 263
User Relationships API tests @author Alex Karshakevich http://drupal.org/user/183217

Class

UserRelationshipsTestCase
Test cases für UR API.

Code

function testNoOnewayRelationships() {
  $this
    ->createDefaultRelationshipTypes(array(
    'twoway',
  ));
  $permissions = array(
    'can have ' . $this->rtypes['twoway']->machine_name . ' relationships',
    'can request ' . $this->rtypes['twoway']->machine_name . ' relationships',
  );
  $u1 = $this
    ->drupalCreateUser($permissions);
  $u2 = $this
    ->drupalCreateUser($permissions);
  $u3 = $this
    ->drupalCreateUser($permissions);
  user_relationships_request_relationship($u1, $u2, $this->rtypes['twoway']);
  user_relationships_request_relationship($u3, $u1, $this->rtypes['twoway']);

  // Load all relationships of this
  $relationships = user_relationships_load(array(
    'user' => $u1->uid,
  ));
  $this
    ->assertEqual(2, count($relationships));
}