From 8e6a69bf0c936d658deeb3714bc2d38b4b8750c8 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 7 Dec 2012 18:50:22 -0600 Subject: [PATCH] [ticket/8323] Unit test for phpbb_get_banned_user_ids PHPBB3-8323 --- tests/functions/fixtures/banned_users.xml | 33 +++++++++++++++++++ tests/functions/phpbb_get_banned_user_ids.php | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tests/functions/fixtures/banned_users.xml create mode 100644 tests/functions/phpbb_get_banned_user_ids.php diff --git a/tests/functions/fixtures/banned_users.xml b/tests/functions/fixtures/banned_users.xml new file mode 100644 index 0000000000..42b73dd270 --- /dev/null +++ b/tests/functions/fixtures/banned_users.xml @@ -0,0 +1,33 @@ + + + + ban_userid + ban_exclude + ban_end + + 1 + 1 + 0 + + + 2 + 0 + 0 + + + 3 + 0 + 0 + + + 4 + 0 + 2 + + + 5 + 0 + 999999999999999999999 + +
+
diff --git a/tests/functions/phpbb_get_banned_user_ids.php b/tests/functions/phpbb_get_banned_user_ids.php new file mode 100644 index 0000000000..226012f68f --- /dev/null +++ b/tests/functions/phpbb_get_banned_user_ids.php @@ -0,0 +1,33 @@ +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)); + } +}