You are here

function OgFieldWidgetTestCase::testUserEdit in Organic groups 7.2

Test a non "administer group" user with pending membership, re-saving user edit.

File

./og.test, line 1211

Class

OgFieldWidgetTestCase
Test the complex widget.

Code

function testUserEdit() {
  $user1 = $this
    ->drupalCreateUser();
  $user2 = $this
    ->drupalCreateUser();
  $settings = array(
    'type' => 'group',
    OG_GROUP_FIELD . '[und][0][value]' => 1,
  );
  $settings['uid'] = $user1->uid;
  $group1 = $this
    ->drupalCreateNode($settings);
  og_group('node', $group1->nid, array(
    'entity' => $user2,
    'state' => OG_STATE_PENDING,
  ));
  $this
    ->drupalLogin($user2);
  $this
    ->drupalPost("user/{$user2->uid}/edit", array(), 'Save');
  $this
    ->assertTrue(og_get_entity_groups('user', $user2, array(
    OG_STATE_PENDING,
  )), 'User membership was retained after user save.');
}