1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-16 21:54:00 +02:00

[ticket/11579] Add remaining unit tests for validate_data functions

This now includes tests for usernames, passwords, emails, and jabber
addresses. A few small changes had to be applied to phpbb_mock_cache
and phpbb_mock_user in order to incorporate needed methods.

PHPBB3-11579
This commit is contained in:
Marc Alexander
2013-05-30 16:05:19 +02:00
parent 3d625ab0cf
commit 3f657bc63e
4 changed files with 375 additions and 62 deletions

View File

@@ -74,6 +74,21 @@ class phpbb_mock_cache
);
}
/**
* Obtain disallowed usernames. Input data via standard put method.
*/
public function obtain_disallowed_usernames()
{
if (($usernames = $this->get('_disallowed_usernames')) !== false)
{
return $usernames;
}
else
{
return array();
}
}
public function set_bots($bots)
{
$this->data['_bots'] = $bots;

View File

@@ -33,4 +33,17 @@ class phpbb_mock_user
{
$this->options[$item] = $value;
}
public function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)
{
$banned_users = $this->optionget('banned_users');
foreach ($banned_users as $banned)
{
if ($banned == $user_id || $banned == $user_ips || $banned == $user_email)
{
return true;
}
}
return false;
}
}