diff options
| author | Nils Adermann <naderman@naderman.de> | 2013-04-11 08:19:32 -0700 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2013-04-11 08:19:32 -0700 |
| commit | 08e7e8722a8cdc3f896b8b31f05d7329070bc664 (patch) | |
| tree | b1399e014c7907c9392455f74b617888f34e2db0 /tests/test_framework/phpbb_functional_test_case.php | |
| parent | 52a0f32d99bf87075049600b15c40147ab698a61 (diff) | |
| parent | 1296417b526312f3b79d2b64bff86476209fb037 (diff) | |
| download | forums-08e7e8722a8cdc3f896b8b31f05d7329070bc664.tar forums-08e7e8722a8cdc3f896b8b31f05d7329070bc664.tar.gz forums-08e7e8722a8cdc3f896b8b31f05d7329070bc664.tar.bz2 forums-08e7e8722a8cdc3f896b8b31f05d7329070bc664.tar.xz forums-08e7e8722a8cdc3f896b8b31f05d7329070bc664.zip | |
Merge pull request #1336 from nickvergessen/ticket/11492
[ticket/11492] Fix error on teampage when there are no users.
Diffstat (limited to 'tests/test_framework/phpbb_functional_test_case.php')
| -rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index a411d9c98a..db6a6066e4 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -316,6 +316,90 @@ 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_log, $phpbb_container, $phpbb_root_path, $phpEx; + + $config = new phpbb_config(array()); + $config['coppa_enable'] = 0; + + $db = $this->get_db(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $user = $this->getMock('phpbb_user'); + $auth = $this->getMock('phpbb_auth'); + + $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $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'); + } + + $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 add_user_group($group_name, $usernames) + { + global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx; + + $config = new phpbb_config(array()); + $config['coppa_enable'] = 0; + + $db = $this->get_db(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $user = $this->getMock('phpbb_user'); + $auth = $this->getMock('phpbb_auth'); + + $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + $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'); + } + + $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_add($group_id, false, $usernames, $group_name); + } + protected function login($username = 'admin') { $this->add_lang('ucp'); |
