mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
[ticket/8323] Unit test for phpbb_get_banned_user_ids
PHPBB3-8323
This commit is contained in:
parent
473a26a553
commit
8e6a69bf0c
2 changed files with 66 additions and 0 deletions
33
tests/functions/fixtures/banned_users.xml
Normal file
33
tests/functions/fixtures/banned_users.xml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?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>
|
||||
</table>
|
||||
</dataset>
|
33
tests/functions/phpbb_get_banned_user_ids.php
Normal file
33
tests/functions/phpbb_get_banned_user_ids.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?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 test_phpbb_get_banned_user_ids()
|
||||
{
|
||||
global $db;
|
||||
|
||||
$db = $this->new_dbal();
|
||||
|
||||
$user_ids = array(1, 2, 4, 5);
|
||||
|
||||
$this->assertEquals(phpbb_get_banned_user_ids($user_ids, true), array(2 => 2, 5 => 5));
|
||||
|
||||
$this->assertEquals(phpbb_get_banned_user_ids($user_ids, false), array(2 => 2));
|
||||
|
||||
$this->assertEquals(phpbb_get_banned_user_ids($user_ids, 2), array(2 => 2, 5 => 5));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue