mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 20:13:22 +01:00
* 'develop' of https://github.com/phpbb/phpbb3: (29 commits) [ticket/11588] Also use version.phpbb.com in install_update.php. [ticket/11587] Add functional tests for group teampage settings [ticket/11538] Add admin as admins leader and moderator in memberlist_test [ticket/11587] Pass legend and teampage settings to group_create() [ticket/11586] Move $filedata['thumbnail'] to where it might be returned. [ticket/11586] Combine $filedata['post_attach'] assign into a single statement. [ticket/11586] Use a variable for $cat_id == ATTACHMENT_CATEGORY_IMAGE. [ticket/11586] Combine administrator/moderator checks together. [ticket/11583] Use a new lang key instead of giving the old one a new meaning. [ticket/11122] Add dhruv to active authors [ticket/11122] Remove Oleg and igorw from active authors [ticket/10840] Add check_form_key to acp_groups.php [ticket/11583] Allow FULLTEXT indexes on InnoDB when on MySQL 5.6.4 or higher. [ticket/11409] Add success message after updating group position settings [ticket/11549] Add functional test for ACP Extension Module with Template [ticket/11570] Fix link and make the notice more conspiciuous [ticket/11549] Do not set extension dir path for style in adm/index.php [ticket/11570] Add link back to update process [ticket/11569] Add type parameter and fix language variable [ticket/11569] Add parameter to URL and remove comment ... Conflicts: tests/functional/common_groups_test.php
106 lines
3.8 KiB
PHP
106 lines
3.8 KiB
PHP
<?php
|
|
/**
|
|
*
|
|
* @package testing
|
|
* @copyright (c) 2012 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @group functional
|
|
*/
|
|
class phpbb_functional_memberlist_test extends phpbb_functional_test_case
|
|
{
|
|
public function test_memberlist()
|
|
{
|
|
$this->create_user('memberlist-test-user');
|
|
// logs in as admin
|
|
$this->login();
|
|
$crawler = self::request('GET', 'memberlist.php?sid=' . $this->sid);
|
|
$this->assertContains('memberlist-test-user', $crawler->text());
|
|
|
|
// restrict by first character
|
|
$crawler = self::request('GET', 'memberlist.php?first_char=m&sid=' . $this->sid);
|
|
$this->assertContains('memberlist-test-user', $crawler->text());
|
|
|
|
// make sure results for wrong character are not returned
|
|
$crawler = self::request('GET', 'memberlist.php?first_char=a&sid=' . $this->sid);
|
|
$this->assertNotContains('memberlist-test-user', $crawler->text());
|
|
}
|
|
|
|
public function test_viewprofile()
|
|
{
|
|
$this->login();
|
|
// XXX hardcoded user id
|
|
$crawler = self::request('GET', 'memberlist.php?mode=viewprofile&u=2&sid=' . $this->sid);
|
|
$this->assertContains('admin', $crawler->filter('h2')->text());
|
|
}
|
|
|
|
protected function get_memberlist_leaders_table_crawler()
|
|
{
|
|
$crawler = self::request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid);
|
|
return $crawler->filter('.forumbg-table');
|
|
}
|
|
|
|
public function test_leaders()
|
|
{
|
|
$this->login();
|
|
$this->create_user('memberlist-test-moderator');
|
|
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
|
|
// Admin in admin group, but not in moderators
|
|
$this->assertContains('admin', $crawler->eq(0)->text());
|
|
$this->assertNotContains('admin', $crawler->eq(1)->text());
|
|
|
|
// memberlist-test-user in neither group
|
|
$this->assertNotContains('memberlist-test-user', $crawler->eq(0)->text());
|
|
$this->assertNotContains('memberlist-test-user', $crawler->eq(1)->text());
|
|
|
|
// memberlist-test-moderator in neither group
|
|
$this->assertNotContains('memberlist-test-moderator', $crawler->eq(0)->text());
|
|
$this->assertNotContains('memberlist-test-moderator', $crawler->eq(1)->text());
|
|
}
|
|
|
|
public function test_leaders_remove_users()
|
|
{
|
|
$this->login();
|
|
|
|
// Remove admin from admins, but is now in moderators
|
|
$this->remove_user_group('ADMINISTRATORS', array('admin'));
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
$this->assertNotContains('admin', $crawler->eq(0)->text());
|
|
$this->assertContains('admin', $crawler->eq(1)->text());
|
|
|
|
// Remove admin from moderators, should not be visible anymore
|
|
$this->remove_user_group('GLOBAL_MODERATORS', array('admin'));
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
$this->assertNotContains('admin', $crawler->eq(0)->text());
|
|
$this->assertNotContains('admin', $crawler->eq(1)->text());
|
|
}
|
|
|
|
public function test_leaders_add_users()
|
|
{
|
|
$this->login();
|
|
|
|
// Add memberlist-test-moderator to moderators
|
|
$this->add_user_group('GLOBAL_MODERATORS', array('memberlist-test-moderator'));
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
$this->assertNotContains('memberlist-test-moderator', $crawler->eq(0)->text());
|
|
$this->assertContains('memberlist-test-moderator', $crawler->eq(1)->text());
|
|
|
|
// Add admin to moderators, should be visible as moderator
|
|
$this->add_user_group('GLOBAL_MODERATORS', array('admin'), true);
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
$this->assertNotContains('admin', $crawler->eq(0)->text());
|
|
$this->assertContains('admin', $crawler->eq(1)->text());
|
|
|
|
// Add admin to admins as leader, should be visible as admin, not moderator
|
|
$this->add_user_group('ADMINISTRATORS', array('admin'), true, true);
|
|
$crawler = $this->get_memberlist_leaders_table_crawler();
|
|
$this->assertContains('admin', $crawler->eq(0)->text());
|
|
$this->assertNotContains('admin', $crawler->eq(1)->text());
|
|
}
|
|
}
|