diff options
author | Marc Alexander <admin@m-a-styles.de> | 2020-01-04 14:19:57 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2020-01-04 14:19:57 +0100 |
commit | ed9cbc89c19bc6321bfdd540f241683b71ea9a6e (patch) | |
tree | f7a19b771025e29522b4b6cf7b2c4591da89a30e /tests/test_framework/phpbb_functional_test_case.php | |
parent | fcca5c5b582c43353be73ae50afb631e51407bbf (diff) | |
parent | 2fdd46b36431ae0f58bb2e78e42553168db9a0ff (diff) | |
download | forums-ed9cbc89c19bc6321bfdd540f241683b71ea9a6e.tar forums-ed9cbc89c19bc6321bfdd540f241683b71ea9a6e.tar.gz forums-ed9cbc89c19bc6321bfdd540f241683b71ea9a6e.tar.bz2 forums-ed9cbc89c19bc6321bfdd540f241683b71ea9a6e.tar.xz forums-ed9cbc89c19bc6321bfdd540f241683b71ea9a6e.zip |
Merge branch 'prep-release-3.2.9' into 3.2.x
Diffstat (limited to 'tests/test_framework/phpbb_functional_test_case.php')
-rw-r--r-- | tests/test_framework/phpbb_functional_test_case.php | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 2659cf6e73..f1b30f0fed 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -623,6 +623,25 @@ class phpbb_functional_test_case extends phpbb_test_case return user_add($user_row); } + /** + * Get group ID + * + * @param string $group_name Group name + * @return int Group id of specified group name + */ + protected function get_group_id($group_name) + { + $db = $this->get_db(); + $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_id; + } + protected function remove_user_group($group_name, $usernames) { global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx; @@ -655,12 +674,7 @@ class phpbb_functional_test_case extends phpbb_test_case 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); + $group_id = $this->get_group_id($group_name); return group_user_del($group_id, false, $usernames, $group_name); } @@ -700,12 +714,7 @@ class phpbb_functional_test_case extends phpbb_test_case 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); + $group_id = $this->get_group_id($group_name); return group_user_add($group_id, false, $usernames, $group_name, $default, $leader); } |