mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
Merge remote-tracking branch 'github-exreaction/ticket/8323' into develop-ascraeus
* github-exreaction/ticket/8323: [ticket/8323] Cache auth request [ticket/8323] Combine into a single query [ticket/8323] Comments on phpbb_get_banned_user_ids input for test [ticket/8323] More readability in test case [ticket/8323] Comments [ticket/8323] dataProvider for the test; better test data [ticket/8323] Comments [ticket/8323] Unit test for phpbb_get_banned_user_ids [ticket/8323] Comments for inactive reasons in constants.php [ticket/8323] Only disable administrative deactivated accounts from receiving PMs [ticket/8323] Allow temporarily banned users to receive PMs, but not a notification [ticket/8323] Correct PM notification settings (only notify those who can receive them) [ticket/8323] Cleanup viewtopic code (not sure how this mess happened) [ticket/8323] Allow sending PMs to temporarily banned users [ticket/8323] Do not allow sending PMs to Inactive users [ticket/8323] Hide the Send PM link if users cannot receive the PM [ticket/8323] Correcting the comment [ticket/8323] Do not allow sending of Private Messages to users who are banned [ticket/8323] Remove code used for testing [ticket/8323] Do not allow sending of Private Messages to users who do not have permission to read private messages Conflicts: phpBB/language/en/ucp.php
This commit is contained in:
38
tests/functions/fixtures/banned_users.xml
Normal file
38
tests/functions/fixtures/banned_users.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_banlist">
|
||||
<column>ban_userid</column>
|
||||
<column>ban_exclude</column>
|
||||
<column>ban_end</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>3</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>4</value>
|
||||
<value>0</value>
|
||||
<value>2</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>5</value>
|
||||
<value>0</value>
|
||||
<value>999999999999999999999</value>
|
||||
</row>
|
||||
<row>
|
||||
<value>6</value>
|
||||
<value>0</value>
|
||||
<value>3</value>
|
||||
</row>
|
||||
</table>
|
||||
</dataset>
|
58
tests/functions/phpbb_get_banned_user_ids.php
Normal file
58
tests/functions/phpbb_get_banned_user_ids.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2012 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php';
|
||||
|
||||
class phpbb_get_banned_user_ids_test extends phpbb_database_test_case
|
||||
{
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/banned_users.xml');
|
||||
}
|
||||
|
||||
public function phpbb_get_banned_user_ids_data()
|
||||
{
|
||||
return array(
|
||||
// Input to phpbb_get_banned_user_ids (user_id list, ban_end)
|
||||
// Expected output
|
||||
array(
|
||||
// True to get users currently banned
|
||||
array(array(1, 2, 4, 5, 6), true),
|
||||
array(2 => 2, 5 => 5),
|
||||
),
|
||||
array(
|
||||
// False to only get permanently banned users
|
||||
array(array(1, 2, 4, 5, 6), false),
|
||||
array(2 => 2),
|
||||
),
|
||||
array(
|
||||
// Unix timestamp to get users banned until that time
|
||||
array(array(1, 2, 4, 5, 6), 2),
|
||||
array(2 => 2, 5 => 5, 6 => 6),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
|
||||
return parent::setUp();
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider phpbb_get_banned_user_ids_data
|
||||
*/
|
||||
public function test_phpbb_get_banned_user_ids($input, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, call_user_func_array('phpbb_get_banned_user_ids', $input));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user