aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions/obtain_online_test.php
diff options
context:
space:
mode:
authorMaat <maat-pub@mageia.biz>2020-05-08 18:29:30 +0200
committerMaat <maat-pub@mageia.biz>2020-05-08 21:36:04 +0200
commit36bc1870f21fac04736a1049c1d5b8e127d729f4 (patch)
tree9d102331eeaf1ef3cd23e656320d7c08e65757ed /tests/functions/obtain_online_test.php
parent8875d385d0579b451dac4d9bda465172b4f69ee0 (diff)
parent149375253685b3a38996f63015a74b7a0f53aa14 (diff)
downloadforums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.gz
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.bz2
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.tar.xz
forums-36bc1870f21fac04736a1049c1d5b8e127d729f4.zip
Merge remote-tracking branch 'upstream/prep-release-3.1.11'
Diffstat (limited to 'tests/functions/obtain_online_test.php')
-rw-r--r--tests/functions/obtain_online_test.php55
1 files changed, 24 insertions, 31 deletions
diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php
index de6451a0db..e793a4eb82 100644
--- a/tests/functions/obtain_online_test.php
+++ b/tests/functions/obtain_online_test.php
@@ -1,15 +1,18 @@
<?php
/**
*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
*
*/
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/auth.php';
class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{
@@ -125,28 +128,28 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{
return array(
array(0, false, array(
- 'online_userlist' => 'REGISTERED_USERS 2, 3',
- 'l_online_users' => 'ONLINE_USERS_TOTAL 5REG_USERS_TOTAL_AND 2HIDDEN_USERS_TOTAL 3',
+ 'online_userlist' => 'REGISTERED_USERS <span class="username">2</span>, <span class="username">3</span>',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL 5 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 3',
)),
array(0, true, array(
- 'online_userlist' => 'REGISTERED_USERS 2, 3',
- 'l_online_users' => 'ONLINE_USERS_TOTAL 7REG_USERS_TOTAL 2HIDDEN_USERS_TOTAL_AND 3GUEST_USERS_TOTAL 2',
+ 'online_userlist' => 'REGISTERED_USERS <span class="username">2</span>, <span class="username">3</span>',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 7 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 3 GUEST_USERS_TOTAL 2',
)),
array(1, false, array(
- 'online_userlist' => 'BROWSING_FORUM 3',
- 'l_online_users' => 'ONLINE_USERS_TOTAL 2REG_USER_TOTAL_AND 1HIDDEN_USER_TOTAL 1',
+ 'online_userlist' => 'BROWSING_FORUM <span class="username">3</span>',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL 2 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1',
)),
array(1, true, array(
- 'online_userlist' => 'BROWSING_FORUM_GUEST 3 1',
- 'l_online_users' => 'ONLINE_USERS_TOTAL 3REG_USER_TOTAL 1HIDDEN_USER_TOTAL_AND 1GUEST_USER_TOTAL 1',
+ 'online_userlist' => 'BROWSING_FORUM_GUESTS 1 <span class="username">3</span>',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 3 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1 GUEST_USERS_TOTAL 1',
)),
array(2, false, array(
'online_userlist' => 'BROWSING_FORUM NO_ONLINE_USERS',
- 'l_online_users' => 'ONLINE_USERS_ZERO_TOTAL 0REG_USERS_ZERO_TOTAL_AND 0HIDDEN_USERS_ZERO_TOTAL 0',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL 0 REG_USERS_TOTAL 0 HIDDEN_USERS_TOTAL 0',
)),
array(2, true, array(
- 'online_userlist' => 'BROWSING_FORUM_GUESTS NO_ONLINE_USERS 0',
- 'l_online_users' => 'ONLINE_USERS_ZERO_TOTAL 0REG_USERS_ZERO_TOTAL 0HIDDEN_USERS_ZERO_TOTAL_AND 0GUEST_USERS_ZERO_TOTAL 0',
+ 'online_userlist' => 'BROWSING_FORUM_GUESTS 0 NO_ONLINE_USERS',
+ 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 0 REG_USERS_TOTAL 0 HIDDEN_USERS_TOTAL 0 GUEST_USERS_TOTAL 0',
)),
);
}
@@ -158,18 +161,21 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{
$this->db->sql_query('DELETE FROM phpbb_sessions');
- global $config, $user, $auth;
+ global $config, $user, $auth, $phpbb_dispatcher;
$config['load_online_guests'] = $display_guests;
+ $user = new phpbb_mock_lang();
$user->lang = $this->load_language();
- $auth = $this->getMock('auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$acl_get_map = array(
array('u_viewonline', true),
+ array('u_viewprofile', true),
);
$auth->expects($this->any())
->method('acl_get')
->with($this->stringContains('_'),
$this->anything())
->will($this->returnValueMap($acl_get_map));
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$time = time();
$this->create_guest_sessions($time);
@@ -215,25 +221,12 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
protected function load_language()
{
- $lang = array(
+ return array(
'NO_ONLINE_USERS' => 'NO_ONLINE_USERS',
'REGISTERED_USERS' => 'REGISTERED_USERS',
'BROWSING_FORUM' => 'BROWSING_FORUM %s',
'BROWSING_FORUM_GUEST' => 'BROWSING_FORUM_GUEST %s %d',
'BROWSING_FORUM_GUESTS' => 'BROWSING_FORUM_GUESTS %s %d',
);
- $vars_online = array('ONLINE', 'REG', 'HIDDEN', 'GUEST');
- foreach ($vars_online as $online)
- {
- $lang = array_merge($lang, array(
- $online . '_USERS_ZERO_TOTAL' => $online . '_USERS_ZERO_TOTAL %d',
- $online . '_USER_TOTAL' => $online . '_USER_TOTAL %d',
- $online . '_USERS_TOTAL' => $online . '_USERS_TOTAL %d',
- $online . '_USERS_ZERO_TOTAL_AND' => $online . '_USERS_ZERO_TOTAL_AND %d',
- $online . '_USER_TOTAL_AND' => $online . '_USER_TOTAL_AND %d',
- $online . '_USERS_TOTAL_AND' => $online . '_USERS_TOTAL_AND %d',
- ));
- }
- return $lang;
}
}