'Atrium Members', 'description' => 'Tests for Atrium Members.', 'group' => 'Atrium', ); } /** * Implementation of setUp(). */ function setUp() { parent::setUp(); $this->atriumBasic(); } /** * Test member visibility. * * This test actually mainly tests code in spaces_og, but due to the fact * that Drupal core provides no instances of {users} table queries going * through db_rewrite_sql() the tests are here. */ function testMemberVisibility() { // When site is in ATRIUM_MEMBERS_ALL mode, users should be able to see all // other users. Put the site in ATRIUM_MEMBERS_ALL mode and test that all // accounts can see all other accounts. $this->drupalLogin($this->atriumUsers['administrator']); $this->drupalPost('features', array('atrium_members' => ATRIUM_MEMBERS_ALL), 'Save configuration'); foreach ($this->atriumUsers as $account) { $this->drupalLogin($account); $this->drupalGet('members'); foreach ($this->atriumUsers as $account2) { $this->assertText($account2->name); } } // When site is in ATRIUM_MEMBERS_GROUP mode, administrators and managers should // see all users while normal users can only see those in their groups. $this->drupalLogin($this->atriumUsers['administrator']); $this->drupalPost('features', array('atrium_members' => ATRIUM_MEMBERS_GROUP), 'Save configuration'); foreach (array('administrator', 'manager', 'user') as $role) { $this->drupalLogin($this->atriumUsers[$role]); $this->drupalGet('members'); foreach ($this->atriumUsers as $account2) { $this->assertText($account2->name); } } // Create a new group and users within that group. They should be able to // see each other and 'administrator' (the group administrator) but not other // non-member users. $this->drupalLogin($this->atriumUsers['administrator']); $private = $this->atriumCreateGroup('atrium_groups_private'); $this->atriumUsers['group_user1'] = $this->atriumCreateUser('user', array($private)); $this->atriumUsers['group_user2'] = $this->atriumCreateUser('user', array($private)); $this->drupalLogin($this->atriumUsers['group_user1']); $this->drupalGet('members'); $this->assertText($this->atriumUsers['group_user1']->name); $this->assertText($this->atriumUsers['group_user2']->name); $this->assertText($this->atriumUsers['administrator']->name); $this->assertNoText($this->atriumUsers['user']->name); $this->assertNoText($this->atriumUsers['manager']->name); } }