diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-04-11 14:06:08 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-04-11 15:00:22 +0200 |
commit | 60713c8a203b4d92db016f38cf8d78165d72b30a (patch) | |
tree | ffb943e72ed94762b93f16db72b491241e6c13d7 | |
parent | 52a0f32d99bf87075049600b15c40147ab698a61 (diff) | |
download | forums-60713c8a203b4d92db016f38cf8d78165d72b30a.tar forums-60713c8a203b4d92db016f38cf8d78165d72b30a.tar.gz forums-60713c8a203b4d92db016f38cf8d78165d72b30a.tar.bz2 forums-60713c8a203b4d92db016f38cf8d78165d72b30a.tar.xz forums-60713c8a203b4d92db016f38cf8d78165d72b30a.zip |
[ticket/11492] Add functional test for empty teampage
PHPBB3-11492
-rw-r--r-- | tests/functional/memberlist_test.php | 9 | ||||
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 40 |
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/functional/memberlist_test.php b/tests/functional/memberlist_test.php index 879bee2f0e..5c5d96d777 100644 --- a/tests/functional/memberlist_test.php +++ b/tests/functional/memberlist_test.php @@ -40,4 +40,13 @@ class phpbb_functional_memberlist_test extends phpbb_functional_test_case $this->assert_response_success(); $this->assertContains('admin', $crawler->filter('h2')->text()); } + + public function test_leaders() + { + $this->login(); + $this->remove_user_group('ADMINISTRATORS', array('admin')); + + $crawler = $this->request('GET', 'memberlist.php?mode=leaders&sid=' . $this->sid); + $this->assert_response_success(); + } } diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index a411d9c98a..283110a104 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -316,6 +316,46 @@ class phpbb_functional_test_case extends phpbb_test_case return user_add($user_row); } + protected function remove_user_group($group_name, $usernames) + { + global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container; + + $config = new phpbb_config(array()); + $config['coppa_enable'] = 0; + + $db = $this->get_db(); + + $cache = new phpbb_mock_null_cache; + + $cache_driver = new phpbb_cache_driver_null(); + $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); + $phpbb_container + ->expects($this->any()) + ->method('get') + ->with('cache.driver') + ->will($this->returnValue($cache_driver)); + + if (!function_exists('utf_clean_string')) + { + require_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php'); + } + if (!function_exists('group_user_del')) + { + require_once(__DIR__ . '/../../phpBB/includes/functions_user.php'); + } + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $auth = $this->getMock('Observer', array('acl_clear_prefetch')); + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape($group_name) . "'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + return group_user_del($group_id, false, $usernames, $group_name); + } + protected function login($username = 'admin') { $this->add_lang('ucp'); |