You are here

function UserRelationshipsTypesTestCase::testNames in User Relationships 7

File

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

Class

UserRelationshipsTypesTestCase
User Relationship type tests.

Code

function testNames() {

  // Create relationship type.
  $relationship_type = (object) array(
    'name' => $this
      ->randomName(),
    'machine_name' => strtolower($this
      ->randomName()),
    'plural_name' => $this
      ->randomName(),
    'reverse_name' => $this
      ->randomName(),
    'reverse_plural_name' => $this
      ->randomName(),
    'name_capitalized' => $this
      ->randomName(),
    'plural_name_capitalized' => $this
      ->randomName(),
    'reverse_name_capitalized' => $this
      ->randomName(),
    'reverse_plural_name_capitalized' => $this
      ->randomName(),
    'requires_approval' => FALSE,
    'expires_val' => 0,
  );

  // First, check all names.
  $this
    ->assertEqual($relationship_type->name, user_relationships_type_get_name($relationship_type));
  $this
    ->assertEqual($relationship_type->plural_name, user_relationships_type_get_name($relationship_type, TRUE));
  $this
    ->assertEqual($relationship_type->reverse_name, user_relationships_type_get_name($relationship_type, FALSE, TRUE));
  $this
    ->assertEqual($relationship_type->reverse_plural_name, user_relationships_type_get_name($relationship_type, TRUE, TRUE));
  $this
    ->assertEqual($relationship_type->name_capitalized, user_relationships_type_get_name($relationship_type, FALSE, FALSE, TRUE));
  $this
    ->assertEqual($relationship_type->plural_name_capitalized, user_relationships_type_get_name($relationship_type, TRUE, FALSE, TRUE));
  $this
    ->assertEqual($relationship_type->reverse_name_capitalized, user_relationships_type_get_name($relationship_type, FALSE, TRUE, TRUE));
  $this
    ->assertEqual($relationship_type->reverse_plural_name_capitalized, user_relationships_type_get_name($relationship_type, TRUE, TRUE, TRUE));
}