[ticket/develop/11543] Use plurals in develop

PHPBB3-11543
This commit is contained in:
Joas Schilling 2013-06-06 23:29:50 +02:00
parent 74aec79551
commit d406dd99d8
2 changed files with 19 additions and 25 deletions

View file

@ -9,7 +9,6 @@
require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.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 class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{ {
@ -125,27 +124,27 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
return array( return array(
array(0, false, array( array(0, false, array(
'online_userlist' => 'REGISTERED_USERS 2, 3', 'online_userlist' => 'REGISTERED_USERS 2, 3',
'l_online_users' => 'ONLINE_USERS_TOTAL 4REG_USERS_TOTAL_AND 2HIDDEN_USERS_TOTAL 2', 'l_online_users' => 'ONLINE_USERS_TOTAL 4 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 2',
)), )),
array(0, true, array( array(0, true, array(
'online_userlist' => 'REGISTERED_USERS 2, 3', 'online_userlist' => 'REGISTERED_USERS 2, 3',
'l_online_users' => 'ONLINE_USERS_TOTAL 6REG_USERS_TOTAL 2HIDDEN_USERS_TOTAL_AND 2GUEST_USERS_TOTAL 2', 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 6 REG_USERS_TOTAL 2 HIDDEN_USERS_TOTAL 2 GUEST_USERS_TOTAL 2',
)), )),
array(1, false, array( array(1, false, array(
'online_userlist' => 'BROWSING_FORUM 3', 'online_userlist' => 'BROWSING_FORUM 3',
'l_online_users' => 'ONLINE_USERS_TOTAL 2REG_USER_TOTAL_AND 1HIDDEN_USER_TOTAL 1', 'l_online_users' => 'ONLINE_USERS_TOTAL 2 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1',
)), )),
array(1, true, array( array(1, true, array(
'online_userlist' => 'BROWSING_FORUM_GUEST 3 1', 'online_userlist' => 'BROWSING_FORUM_GUESTS 1 3',
'l_online_users' => 'ONLINE_USERS_TOTAL 3REG_USER_TOTAL 1HIDDEN_USER_TOTAL_AND 1GUEST_USER_TOTAL 1', 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 3 REG_USERS_TOTAL 1 HIDDEN_USERS_TOTAL 1 GUEST_USERS_TOTAL 1',
)), )),
array(2, false, array( array(2, false, array(
'online_userlist' => 'BROWSING_FORUM NO_ONLINE_USERS', '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( array(2, true, array(
'online_userlist' => 'BROWSING_FORUM_GUESTS NO_ONLINE_USERS 0', 'online_userlist' => 'BROWSING_FORUM_GUESTS 0 NO_ONLINE_USERS',
'l_online_users' => 'ONLINE_USERS_ZERO_TOTAL 0REG_USERS_ZERO_TOTAL 0HIDDEN_USERS_ZERO_TOTAL_AND 0GUEST_USERS_ZERO_TOTAL 0', 'l_online_users' => 'ONLINE_USERS_TOTAL_GUESTS 0 REG_USERS_TOTAL 0 HIDDEN_USERS_TOTAL 0 GUEST_USERS_TOTAL 0',
)), )),
); );
} }
@ -157,18 +156,21 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
{ {
$this->db->sql_query('DELETE FROM phpbb_sessions'); $this->db->sql_query('DELETE FROM phpbb_sessions');
global $config, $user, $auth; global $config, $user, $auth, $phpbb_dispatcher;
$config['load_online_guests'] = $display_guests; $config['load_online_guests'] = $display_guests;
$user = new phpbb_mock_lang();
$user->lang = $this->load_language(); $user->lang = $this->load_language();
$auth = $this->getMock('auth'); $auth = $this->getMock('phpbb_auth');
$acl_get_map = array( $acl_get_map = array(
array('u_viewonline', true), array('u_viewonline', true),
array('u_viewprofile', true),
); );
$auth->expects($this->any()) $auth->expects($this->any())
->method('acl_get') ->method('acl_get')
->with($this->stringContains('_'), ->with($this->stringContains('_'),
$this->anything()) $this->anything())
->will($this->returnValueMap($acl_get_map)); ->will($this->returnValueMap($acl_get_map));
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$time = time(); $time = time();
$this->create_guest_sessions($time); $this->create_guest_sessions($time);
@ -213,25 +215,12 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
protected function load_language() protected function load_language()
{ {
$lang = array( return array(
'NO_ONLINE_USERS' => 'NO_ONLINE_USERS', 'NO_ONLINE_USERS' => 'NO_ONLINE_USERS',
'REGISTERED_USERS' => 'REGISTERED_USERS', 'REGISTERED_USERS' => 'REGISTERED_USERS',
'BROWSING_FORUM' => 'BROWSING_FORUM %s', 'BROWSING_FORUM' => 'BROWSING_FORUM %s',
'BROWSING_FORUM_GUEST' => 'BROWSING_FORUM_GUEST %s %d', 'BROWSING_FORUM_GUEST' => 'BROWSING_FORUM_GUEST %s %d',
'BROWSING_FORUM_GUESTS' => 'BROWSING_FORUM_GUESTS %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;
} }
} }

View file

@ -30,4 +30,9 @@ class phpbb_mock_lang implements ArrayAccess
public function offsetUnset($offset) public function offsetUnset($offset)
{ {
} }
public function lang()
{
return implode(' ', func_get_args());
}
} }