function OgGroupAudienceField::testOgAudienceFieldBasic in Organic groups 7
No groups and a group is added.
File
- ./
og.test, line 1073  
Class
- OgGroupAudienceField
 - Test group audience field.
 
Code
function testOgAudienceFieldBasic() {
  // Create user.
  $web_user = $this
    ->drupalCreateUser(array(
    'access content',
    'administer content types',
    'create article content',
    'edit any article content',
  ));
  $this
    ->drupalLogin($web_user);
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertText(t('There are no groups you can select from.'), 'Field group audience shows correct description about no groups.');
  // Create an entity that is a group.
  $entity = entity_create('entity_test', array(
    'name' => 'main',
    'uid' => $web_user->uid,
  ));
  $entity->{OG_GROUP_FIELD}[LANGUAGE_NONE][0]['value'] = 1;
  $entity
    ->save();
  $group = og_get_group('entity_test', $entity->pid);
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertText(t('Select the groups this content should be associated with.'), 'Field group audience shows correct description about existing groups.');
}