View source
<?php
class SpacesOGTestCase extends DrupalWebTestCase {
protected $admin_user;
protected $simple_user;
public function setUp() {
parent::setUp('context', 'ctools', 'strongarm', 'views', 'features', 'features_test', 'og', 'og_access', 'og_views', 'purl', 'spaces', 'spaces_ui', 'spaces_og', 'spaces_test', 'taxonomy');
$this
->loginAdminUser();
$this
->drupalPost('admin/content/node-settings/rebuild', array(), 'Rebuild permissions');
$edit = array(
'spaces_preset_og' => 'og_public',
);
$this
->drupalPost('admin/build/spaces', $edit, 'Save configuration');
$edit = array(
'name' => 'Group',
'type' => 'group',
'og_content_type_usage' => 'group',
);
$this
->drupalPost('admin/content/types/add', $edit, 'Save content type');
$this
->assertText('The content type Group has been added.');
$edit = array(
'title' => 'Group A',
'og_description' => 'Group A.',
'purl[value]' => 'group-a',
);
$this
->drupalPost('node/add/group', $edit, 'Save');
$this
->assertText('Group Group A has been created.');
$this
->assertEqual('og_public', unserialize(db_result(db_query('SELECT value from {spaces_overrides} WHERE id = 1'))));
}
public function tearDown() {
unset($this->admin_user);
unset($this->simple_user);
parent::tearDown();
}
protected function loginAdminUser() {
if (empty($this->admin_user)) {
$this->admin_user = $this
->drupalCreateUser(array(
'access content',
'administer nodes',
'administer content types',
'administer site configuration',
'access administration pages',
'administer spaces',
'administer organic groups',
));
}
$this
->drupalLogin($this->admin_user);
}
protected function loginSimpleUser() {
if (empty($this->simple_user)) {
$this->simple_user = $this
->drupalCreateUser(array(
'access user profiles',
'access comments',
'post comments',
'post comments without approval',
'access content',
'create features_test content',
'edit own features_test content',
'delete own features_test content',
));
}
$this
->drupalLogin($this->simple_user);
}
protected function nodeAccess($nid) {
$rows = array();
$result = db_query('select * from {node_access} where nid = %d', $nid);
while ($row = db_fetch_array($result)) {
$rows[$row['realm']] = $row;
}
return $rows;
}
}
class SpacesOGTestCRUD extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: CRUD'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
function testCRUD() {
$realms = array(
'og_admin' => array(
'gid' => 1,
'grant_view' => 1,
'grant_update' => 1,
'grant_delete' => 0,
),
'og_public' => array(
'gid' => 0,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
),
'og_subscriber' => array(
'gid' => 1,
'grant_view' => 1,
'grant_update' => 0,
'grant_delete' => 0,
),
);
$presets = array(
'og_controlled' => array(
'og' => array(
'og_selective' => 1,
'og_register' => 1,
'og_directory' => 1,
'og_private' => 0,
),
'node_access' => array(
'og_public',
'og_admin',
),
),
'og_private' => array(
'og' => array(
'og_selective' => 3,
'og_register' => 0,
'og_directory' => 0,
'og_private' => 1,
),
'node_access' => array(
'og_admin',
'og_subscriber',
),
),
'og_public' => array(
'og' => array(
'og_selective' => 0,
'og_register' => 1,
'og_directory' => 1,
'og_private' => 0,
),
'node_access' => array(
'og_public',
'og_admin',
),
),
);
foreach ($presets as $preset => $config) {
$edit = array(
'spaces_preset_og' => $preset,
);
$this
->drupalPost('node/1/edit', $edit, 'Save');
$value = unserialize(db_result(db_query('SELECT value from {spaces_overrides} WHERE id = 1')));
$this
->assertEqual($value, $preset);
$og = db_fetch_array(db_query('SELECT og_selective, og_register, og_directory, og_private FROM {og} WHERE nid = 1'));
foreach ($config['og'] as $k => $v) {
$this
->assertEqual($og[$k], $v);
}
foreach ($config['node_access'] as $realm) {
$this
->assertEqual(2, db_result(db_query('SELECT COUNT(*) FROM {node_access} WHERE nid = 1')));
$access = db_fetch_array(db_query('SELECT * FROM {node_access} WHERE nid = 1 AND realm = "%s"', $realm));
foreach ($realms[$realm] as $k => $v) {
$this
->assertEqual($access[$k], $v);
}
}
}
$this
->drupalPost('node/1/delete', array(), 'Delete group');
$this
->assertText('Group Group A has been deleted.');
$this
->assertEqual(0, db_result(db_query('SELECT count(*) FROM {spaces_overrides} WHERE id = 1')));
$this
->assertEqual(0, db_result(db_query('SELECT count(*) FROM {purl} WHERE id = 1')));
}
}
class SpacesOGTestOverrides extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: Overrides'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
function testOverrides() {
$this
->drupalGet('group-a/node/1/features/overrides');
$this
->assertPattern('/spaces_preset_og(.*?)og_public/');
$this
->assertPattern('/spaces_og_selective(.*?)0(.*?)inherited/');
$this
->assertPattern('/spaces_og_register(.*?)1(.*?)inherited/');
$this
->assertPattern('/spaces_og_directory(.*?)1(.*?)inherited/');
$this
->assertPattern('/spaces_og_private(.*?)0(.*?)inherited/');
$this
->assertNoText('features_test_setting');
$this
->drupalPost('group-a/node/1/features/features_test', array(), 'Save for Group A');
$this
->assertText('The configuration options have been saved for Group A.');
$this
->drupalGet('group-a/node/1/features/overrides');
$this
->assertRaw('features_test_setting');
$this
->assertEqual('0', unserialize(db_result(db_query('SELECT value FROM {spaces_overrides} WHERE object_id = "features_test_setting" AND id = 1'))));
$this
->drupalPost('group-a/node/1/features/features_test', array(
'features_test_setting' => 1,
), 'Save for Group A');
$this
->drupalGet('group-a/node/1/features/overrides');
$this
->assertRaw('features_test_setting');
$this
->assertEqual('1', unserialize(db_result(db_query('SELECT value FROM {spaces_overrides} WHERE object_id = "features_test_setting" AND id = 1'))));
$this
->drupalGet('admin/build/spaces');
$this
->assertNoText('Overridden');
$this
->drupalGet('admin/build/spaces/og_public');
$this
->assertNoText('features_test_setting');
$edit = array(
'variable[features_test_setting]' => 1,
);
$this
->drupalPost('group-a/node/1/features/overrides', $edit, 'Save to preset');
$this
->assertText('Saved preset Public group.');
$preset = unserialize(db_result(db_query('SELECT value FROM {spaces_presets} WHERE name = "og_public" AND space_type = "og"')));
$this
->assertEqual('1', $preset['variable']['features_test_setting']);
$this
->drupalGet('admin/build/spaces');
$this
->assertText('Overridden');
$this
->drupalGet('admin/build/spaces/list/og_public/edit');
$this
->assertPattern('/features_test_setting(.*?)1/');
}
}
class SpacesOGTestFeatures extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: Features'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
function testFeatures() {
$this
->drupalGet('features');
$elems = $this
->xpath('//select[@name="spaces_features[features_test]"]/option[@selected="selected"]');
$this
->assert('Disabled' == (string) $elems[0]);
$this
->drupalGet('node/add');
$this
->assertNoText('Features test');
$this
->drupalGet('node/add/features-test');
$this
->assertResponse(403);
$this
->drupalGet('group-a/node/1/features');
$elems = $this
->xpath('//select[@name="spaces_features[features_test]"]/option[@selected="selected"]');
$this
->assert('Disabled' == (string) $elems[0]);
$this
->drupalGet('group-a/node/add');
$this
->assertNoText('Features test');
$this
->drupalGet('group-a/node/add/features-test');
$this
->assertResponse(403);
$this
->drupalPost('group-a/features', array(
'spaces_features[features_test]' => '1',
), 'Save configuration');
$this
->assertText('The configuration options have been saved.');
$this
->drupalGet('node/add');
$this
->assertText('Testing: Features');
$this
->drupalPost('node/add/features-test', array(
'title' => 'Post outside of Group',
), 'Save');
$this
->assertText('Testing: Features Post outside of Group has been created.');
$this
->drupalPost('features', array(
'spaces_features[features_test]' => '0',
), 'Save configuration');
$this
->drupalGet('group-a/node/1/features');
$elems = $this
->xpath('//select[@name="spaces_features[features_test]"]/option[@selected="selected"]');
$this
->assert('Disabled' == (string) $elems[0]);
$this
->drupalGet('node/add/features-test');
$this
->assertResponse(403);
$this
->drupalPost('group-a/node/1/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group A');
$elems = $this
->xpath('//select[@name="spaces_features[features_test]"]/option[@selected="selected"]');
$this
->assert('Enabled' == (string) $elems[0]);
$this
->drupalGet('group-a/node/add');
$this
->assertText('Testing: Features');
$this
->drupalPost('group-a/node/add/features-test', array(
'title' => 'Post in Group space',
), 'Save');
$this
->assertText('Testing: Features Post in Group space has been created.');
$this
->drupalGet('node/add/features-test');
$this
->assertResponse(403);
}
}
class SpacesOGTestAccess extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: Access'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
function testAccess() {
$this
->drupalPost('group-a/node/1/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group A');
$this
->pass($output);
$this
->drupalGet('group-a/node/add/features-test');
$this
->assertText('A post of this type is public. All visitors will be able to see it.');
$this
->drupalPost('group-a/node/add/features-test', array(
'title' => 'Public post',
), 'Save');
$this
->assertText('Testing: Features Public post has been created.');
$this
->assertEqual(1, db_result(db_query('SELECT count(*) FROM {og_ancestry} WHERE group_nid = 1 AND nid = 2;')));
$access = $this
->nodeAccess(2);
$this
->assertEqual($access['og_public']['gid'], 0);
$this
->assertEqual($access['og_public']['grant_view'], 1);
$this
->assertEqual($access['og_public']['grant_update'], 0);
$this
->assertEqual($access['og_public']['grant_delete'], 0);
$this
->assertEqual($access['og_admin']['gid'], 1);
$this
->assertEqual($access['og_admin']['grant_view'], 1);
$this
->assertEqual($access['og_admin']['grant_update'], 1);
$this
->assertEqual($access['og_admin']['grant_delete'], 1);
$this
->assertEqual($access['og_subscriber']['gid'], 1);
$this
->assertEqual($access['og_subscriber']['grant_view'], 1);
$this
->assertEqual($access['og_subscriber']['grant_update'], 0);
$this
->assertEqual($access['og_subscriber']['grant_delete'], 0);
$edit = array(
'title' => 'Group B',
'og_description' => 'Group B.',
'purl[value]' => 'group-b',
'spaces_preset_og' => 'og_controlled',
);
$this
->drupalPost('node/add/group', $edit, 'Save');
$this
->assertEqual('og_controlled', unserialize(db_result(db_query('SELECT value from {spaces_overrides} WHERE id = 3'))));
$this
->drupalPost('group-b/node/3/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group B');
$this
->drupalGet('group-b/node/add/features-test');
$this
->assertText('A post of this type is public. All visitors will be able to see it.');
$this
->drupalPost('group-b/node/add/features-test', array(
'title' => 'Protected post',
), 'Save');
$this
->assertText('Testing: Features Protected post has been created.');
$this
->assertEqual(1, db_result(db_query('SELECT count(*) FROM {og_ancestry} WHERE group_nid = 3 AND nid = 4;')));
$access = $this
->nodeAccess(4);
$this
->assertEqual($access['og_public']['gid'], 0);
$this
->assertEqual($access['og_public']['grant_view'], 1);
$this
->assertEqual($access['og_public']['grant_update'], 0);
$this
->assertEqual($access['og_public']['grant_delete'], 0);
$this
->assertEqual($access['og_admin']['gid'], 3);
$this
->assertEqual($access['og_admin']['grant_view'], 1);
$this
->assertEqual($access['og_admin']['grant_update'], 1);
$this
->assertEqual($access['og_admin']['grant_delete'], 1);
$this
->assertEqual($access['og_subscriber']['gid'], 3);
$this
->assertEqual($access['og_subscriber']['grant_view'], 1);
$this
->assertEqual($access['og_subscriber']['grant_update'], 0);
$this
->assertEqual($access['og_subscriber']['grant_delete'], 0);
$edit = array(
'title' => 'Group C',
'og_description' => 'Group C.',
'purl[value]' => 'group-c',
'spaces_preset_og' => 'og_private',
);
$this
->drupalPost('node/add/group', $edit, 'Save');
$this
->assertEqual('og_private', unserialize(db_result(db_query('SELECT value from {spaces_overrides} WHERE id = 5'))));
$this
->drupalPost('group-c/node/5/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group C');
$this
->drupalGet('group-c/node/add/features-test');
$this
->assertText('A post of this type is private. Only members of this group will be able to see it.');
$this
->drupalPost('group-c/node/add/features-test', array(
'title' => 'Private post',
), 'Save');
$this
->assertText('Testing: Features Private post has been created.');
$this
->assertEqual(1, db_result(db_query('SELECT count(*) FROM {og_ancestry} WHERE group_nid = 5 AND nid = 6;')));
$access = $this
->nodeAccess(5);
$this
->assertEqual(isset($access['og_public']), FALSE);
$this
->assertEqual($access['og_admin']['gid'], 5);
$this
->assertEqual($access['og_admin']['grant_view'], 1);
$this
->assertEqual($access['og_admin']['grant_update'], 1);
$this
->assertEqual($access['og_admin']['grant_delete'], 0);
$this
->assertEqual($access['og_subscriber']['gid'], 5);
$this
->assertEqual($access['og_subscriber']['grant_view'], 1);
$this
->assertEqual($access['og_subscriber']['grant_update'], 0);
$this
->assertEqual($access['og_subscriber']['grant_delete'], 0);
$access = $this
->nodeAccess(6);
$this
->assertEqual(isset($access['og_public']), FALSE);
$this
->assertEqual($access['og_admin']['gid'], 5);
$this
->assertEqual($access['og_admin']['grant_view'], 1);
$this
->assertEqual($access['og_admin']['grant_update'], 1);
$this
->assertEqual($access['og_admin']['grant_delete'], 1);
$this
->assertEqual($access['og_subscriber']['gid'], 5);
$this
->assertEqual($access['og_subscriber']['grant_view'], 1);
$this
->assertEqual($access['og_subscriber']['grant_update'], 0);
$this
->assertEqual($access['og_subscriber']['grant_delete'], 0);
$this
->assertEqual(0, db_result(db_query('SELECT COUNT(*) FROM {node_access} WHERE nid = 0 AND grant_view = 1')), 'Global grant_view is absent.');
$this
->loginSimpleUser();
$this
->drupalGet('group-a/node/1');
$this
->assertResponse(200);
$this
->drupalGet('group-a/node/2');
$this
->assertResponse(200);
$this
->assertText('Public post');
$this
->drupalGet('group-a/node/add/features-test');
$this
->assertResponse(403);
$this
->drupalPost('group-a/og/subscribe/1', array(), 'Join');
$this
->assertText('You are now a member of Group A.');
$this
->drupalGet('group-a/node/add/features-test');
$this
->assertResponse(200);
$this
->drupalPost('group-a/node/add/features-test', array(
'title' => 'Another public post',
), 'Save');
$this
->assertText('Testing: Features Another public post has been created.');
$this
->drupalGet('group-b/node/3');
$this
->assertResponse(200);
$this
->drupalGet('group-b/node/4');
$this
->assertResponse(200);
$this
->assertText('Protected post');
$this
->drupalGet('group-b/node/add/features-test');
$this
->assertResponse(403);
$this
->drupalPost('group-b/og/subscribe/3', array(), 'Join');
$this
->assertText('Membership request to the Group B group awaits approval by an administrator.');
$this
->loginAdminUser();
$this
->drupalGet('group-b/og/users/3');
$this
->clickLink('approve');
$this
->assertText('Membership request approved.');
$this
->loginSimpleUser();
$this
->drupalGet('group-b/node/add/features-test');
$this
->assertResponse(200);
$this
->drupalPost('group-b/node/add/features-test', array(
'title' => 'Another protected post',
), 'Save');
$this
->assertText('Testing: Features Another protected post has been created.');
$this
->loginSimpleUser();
$this
->drupalGet('group-c/node/5');
$this
->assertResponse(403);
$this
->assertNoText('Group C');
$this
->drupalGet('group-c/node/6');
$this
->assertResponse(403);
$this
->assertNoText('Private post');
$this
->drupalGet('group-c/node/add/features-test');
$this
->assertResponse(403);
$this
->drupalGet('group-c/og/subscribe/5');
$this
->assertResponse(403);
$this
->loginAdminUser();
$this
->drupalPost('group-c/og/users/5/add_user', array(
'og_names' => $this->simple_user->name,
), 'Add users');
$this
->assertText('1 user added to the group.');
$this
->loginSimpleUser();
$this
->drupalGet('group-c/node/5');
$this
->assertResponse(200);
$this
->assertText('Group C');
$this
->drupalGet('group-c/node/6');
$this
->assertResponse(200);
$this
->assertText('Private post');
$this
->drupalGet('group-c/node/add/features-test');
$this
->assertResponse(200);
$this
->drupalPost('group-c/node/add/features-test', array(
'title' => 'Another private post',
), 'Save');
$this
->assertText('Testing: Features Another private post has been created.');
$this
->loginAdminUser();
$edit = array(
'spaces_preset_og' => 'og_public',
);
$this
->drupalPost('group-c/node/5/edit', $edit, 'Save');
$this
->assertText('The content access permissions need to be rebuilt.');
$this
->drupalPost('admin/content/node-settings/rebuild', array(), 'Rebuild permissions');
$this
->drupalPost("group-c/og/unsubscribe/5/{$this->simple_user->uid}", array(), 'Remove');
$this
->loginSimpleUser();
$this
->drupalGet('group-c/node/5');
$this
->assertResponse(200);
$this
->assertText('Group C');
$this
->drupalGet('group-c/node/6');
$this
->assertResponse(200);
$this
->loginAdminUser();
$edit = array(
'spaces_preset_og' => 'og_private',
);
$this
->drupalPost('group-c/node/5/edit', $edit, 'Save');
$this
->assertText('The content access permissions need to be rebuilt.');
$this
->drupalPost('admin/content/node-settings/rebuild', array(), 'Rebuild permissions');
$this
->loginSimpleUser();
$this
->drupalGet('group-c/node/5');
$this
->assertResponse(403);
$this
->drupalGet('group-c/node/6');
$this
->assertResponse(403);
}
}
class SpacesOGTestRouter extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: Router'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
function testRouter() {
$this
->drupalPost('features', array(
'spaces_features[features_test]' => '1',
), 'Save configuration');
$edit = array(
'title' => 'Group B',
'og_description' => 'Group B.',
'purl[value]' => 'group-b',
);
$this
->drupalPost('node/add/group', $edit, 'Save');
$this
->drupalPost('node/1/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group A');
$this
->loginSimpleUser();
$this
->drupalPost('group-a/og/subscribe/1', array(), 'Join');
$this
->drupalPost('group-a/node/add/features-test', array(
'title' => 'Test post',
), 'Save');
foreach (array(
'node/1',
'node/3',
'group-b/node/1',
'group-b/node/3',
) as $path) {
$this
->drupalGet($path);
$this
->assertTrue(FALSE !== strpos($this
->getUrl(), 'group-a'));
}
$this
->drupalGet('node/add/features-test');
$this
->drupalPost('node/add/features-test', array(
'title' => 'Not in group (accident)',
), 'Save');
$this
->assertText('Not in group');
$this
->assertNoText('This content type is supposed to be posted within a group but it is not.');
$this
->loginAdminUser();
$this
->drupalPost('admin/og/og', array(
'og_audience_required' => '1',
), 'Save configuration');
$this
->assertText('The configuration options have been saved.');
$this
->loginSimpleUser();
$this
->drupalGet('node/4/edit');
$this
->assertText('This content type is supposed to be posted within a group but it is not. You will not be able to save this node. Please contact a site administrator to fix the issue.');
$this
->loginAdminUser();
$this
->drupalPost('node/4/edit', array(
'spaces_og_audience' => 1,
), 'Save');
$this
->loginSimpleUser();
$this
->drupalGet('node/4/edit');
$this
->assertTrue(FALSE !== strpos($this
->getUrl(), 'group-a'));
$this
->assertNoText('This content type is supposed to be posted within a group but it is not.');
}
}
class SpacesOGTestAutocomplete extends SpacesOGTestCase {
public function getInfo() {
return array(
'name' => t('Spaces OG: Autocomplete'),
'description' => t('Tests Spaces / Organic Groups integration. <strong>Requires Purl, Organic groups and Views</strong>.'),
'group' => t('Spaces'),
);
}
public function setUp() {
parent::setUp();
$vocab = array(
'name' => 'Tags',
'description' => 'Test vocab.',
'multiple' => 1,
'tags' => 1,
'nodes' => array(
'features_test ' => TRUE,
),
);
taxonomy_save_vocabulary($vocab);
$this->simpleUserPerms = array(
'access user profiles',
'access comments',
'post comments',
'post comments without approval',
'access content',
'create features_test content',
'edit own features_test content',
'delete own features_test content',
);
}
protected function createNamedUser($permissions = NULL, $name = NULL) {
if (!($rid = $this
->drupalCreateRole($permissions))) {
return FALSE;
}
$edit = array();
$edit['name'] = isset($name) ? $name : $this
->randomName();
$edit['mail'] = $edit['name'] . '@example.com';
$edit['roles'] = array(
$rid => $rid,
);
$edit['pass'] = user_password();
$edit['status'] = 1;
$account = user_save('', $edit);
$this
->assertTrue(!empty($account->uid), t('User created with name %name and pass %pass', array(
'%name' => $edit['name'],
'%pass' => $edit['pass'],
)), t('User login'));
if (empty($account->uid)) {
return FALSE;
}
$account->pass_raw = $edit['pass'];
return $account;
}
function testAutocomplete() {
$this
->loginAdminUser();
$edit = array(
'title' => 'Group B',
'og_description' => 'Group B.',
'purl[value]' => 'group-b',
);
$this
->drupalPost('node/add/group', $edit, 'Save');
$this
->drupalPost('group-a/node/1/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group A');
$this
->drupalPost('group-b/node/2/features', array(
'spaces_features[features_test]' => '1',
), 'Save for Group B');
$this
->drupalPost('group-a/node/add/features-test', array(
'title' => 'Fruit post',
'taxonomy[tags][1]' => 'bananas, apples, oranges',
), 'Save');
$this
->drupalPost('group-b/node/add/features-test', array(
'title' => 'Veggie post',
'taxonomy[tags][1]' => 'broccoli, artichoke, oregano',
), 'Save');
$this
->loginSimpleUser();
$this
->drupalPost('group-a/og/subscribe/1', array(), 'Join');
$this
->drupalGet('taxonomy/autocomplete/1/b');
$this
->assertRaw('bananas');
$this
->assertNoRaw('broccoli');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, a');
$this
->assertRaw('apples');
$this
->assertNoRaw('artichoke');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, apples, or');
$this
->assertRaw('oranges');
$this
->assertNoRaw('oregano');
$this
->drupalPost('group-b/og/subscribe/2', array(), 'Join');
$this
->drupalGet('taxonomy/autocomplete/1/b');
$this
->assertRaw('bananas');
$this
->assertRaw('broccoli');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, a');
$this
->assertRaw('apples');
$this
->assertRaw('artichoke');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, apples, or');
$this
->assertRaw('oranges');
$this
->assertRaw('oregano');
$this
->drupalPost("group-a/og/unsubscribe/1/{$this->simple_user->uid}", array(), 'Leave');
$this
->drupalGet('taxonomy/autocomplete/1/b');
$this
->assertNoRaw('bananas');
$this
->assertRaw('broccoli');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, a');
$this
->assertNoRaw('apples');
$this
->assertRaw('artichoke');
$this
->drupalGet('taxonomy/autocomplete/1/bananas, apples, or');
$this
->assertNoRaw('oranges');
$this
->assertRaw('oregano');
$joe = $this
->createNamedUser($this->simpleUserPerms, 'testjoe');
$this
->drupalLogin($joe);
$this
->drupalPost('group-a/og/subscribe/1', array(), 'Join');
$joan = $this
->createNamedUser($this->simpleUserPerms, 'testjoan');
$this
->drupalLogin($joan);
$this
->drupalPost('group-b/og/subscribe/2', array(), 'Join');
$this
->loginSimpleUser();
$this
->drupalGet('user/autocomplete/testjo');
$this
->assertNoRaw('testjoe');
$this
->assertRaw('testjoan');
$this
->drupalPost('group-a/og/subscribe/1', array(), 'Join');
$this
->drupalGet('user/autocomplete/testjo');
$this
->assertRaw('testjoe');
$this
->assertRaw('testjoan');
$this
->drupalPost("group-b/og/unsubscribe/2/{$this->simple_user->uid}", array(), 'Leave');
$this
->drupalGet('user/autocomplete/testjo');
$this
->assertRaw('testjoe');
$this
->assertNoRaw('testjoan');
}
}