aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-07-26 16:12:21 +0200
committerIgor Wiedler <igor@wiedler.ch>2012-07-26 16:12:21 +0200
commitcec4c94f2edff43508f20d8838399f4114557134 (patch)
treea130a5bebdfb2d09de0de9293882ad74d6726333 /tests
parent8a264228d01215fe1020bf946fc95c804ba95450 (diff)
parentd1e56868667234b4d8ea61a79463c3e3e47efa80 (diff)
downloadforums-cec4c94f2edff43508f20d8838399f4114557134.tar
forums-cec4c94f2edff43508f20d8838399f4114557134.tar.gz
forums-cec4c94f2edff43508f20d8838399f4114557134.tar.bz2
forums-cec4c94f2edff43508f20d8838399f4114557134.tar.xz
forums-cec4c94f2edff43508f20d8838399f4114557134.zip
Merge remote-tracking branch 'upstream/develop' into feature/dic
* upstream/develop: (39 commits) [ticket/11025] Add underline for hover to classes [ticket/11025] Replace <b> with <strong> and/or class for semantic styling in subsilver2 [ticket/11025] Replace <b> with <strong> and/or class for semantic styling [ticket/11025] Make last topic titles in forum list Bold [prep-release-3.0.11] Update Changelog for 3.0.11-RC2 release. [prep-release-3.0.11] Bumping version number for 3.0.11-RC2. [ticket/10965] Profile data is only grabbed when show_novalue is enabled [ticket/10965] Make sure all profile fields are always grabbed on viewtopic [ticket/10965] Database update was referring to 3.0.5 instead of 3.0.11-RC1 [ticket/10965] Introduce a new profile field option to display no value [ticket/10990] Changes for develop [ticket/10990] Do not use comma separator when storing it as a log. [ticket/10990] Use $user->lang['COMMA_SEPARATOR'] when appropriate [ticket/10667] Fix tests under MySQL 5.5 strict mode (once again) [ticket/10667] Fix tests under MySQL 5.5 strict mode (once again) [ticket/11012] Fix php_ext change in mock_extension_manager [ticket/11012] Normalize $phpEx member vars to $php_ext [ticket/11002] Use translating option to rename the Etc/GMT options [ticket/11009] Backport build.xml from develop to fix Bamboo Unit Testing. [ticket/11008] Change onunload_functions to not use eval() ...
Diffstat (limited to 'tests')
-rw-r--r--tests/mock/extension_manager.php2
-rw-r--r--tests/privmsgs/delete_user_pms_test.php102
-rw-r--r--tests/privmsgs/fixtures/delete_user_pms.xml215
3 files changed, 318 insertions, 1 deletions
diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php
index 77f799dd3b..fdda4cbadc 100644
--- a/tests/mock/extension_manager.php
+++ b/tests/mock/extension_manager.php
@@ -12,7 +12,7 @@ class phpbb_mock_extension_manager extends phpbb_extension_manager
public function __construct($phpbb_root_path, $extensions = array())
{
$this->phpbb_root_path = $phpbb_root_path;
- $this->phpEx = '.php';
+ $this->php_ext = '.php';
$this->extensions = $extensions;
}
}
diff --git a/tests/privmsgs/delete_user_pms_test.php b/tests/privmsgs/delete_user_pms_test.php
new file mode 100644
index 0000000000..265df1596a
--- /dev/null
+++ b/tests/privmsgs/delete_user_pms_test.php
@@ -0,0 +1,102 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions_privmsgs.php';
+
+class phpbb_privmsgs_delete_user_pms_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/delete_user_pms.xml');
+ }
+
+ public static function delete_user_pms_data()
+ {
+ return array(
+ // array(
+ // (user we delete),
+ // array(remaining privmsgs ids),
+ // array(remaining privmsgs_to),
+ // ),
+ array(
+ 2,
+ array(
+ array('msg_id' => 1),
+ ),
+ array(
+ array('msg_id' => 1, 'user_id' => 3),
+ ),
+ ),
+ array(
+ 3,
+ array(
+ array('msg_id' => 1),
+ array('msg_id' => 2),
+ array('msg_id' => 3),
+ array('msg_id' => 5),
+ ),
+ array(
+ array('msg_id' => 1, 'user_id' => 2),
+ array('msg_id' => 1, 'user_id' => 4),
+ array('msg_id' => 2, 'user_id' => 2),
+ array('msg_id' => 2, 'user_id' => 4),
+ array('msg_id' => 3, 'user_id' => 2),
+ array('msg_id' => 5, 'user_id' => 2),
+ array('msg_id' => 5, 'user_id' => 4),
+ ),
+ ),
+ array(
+ 5,
+ array(
+ array('msg_id' => 1),
+ array('msg_id' => 2),
+ array('msg_id' => 3),
+ array('msg_id' => 4),
+ array('msg_id' => 5),
+ ),
+ array(
+ array('msg_id' => 1, 'user_id' => 2),
+ array('msg_id' => 1, 'user_id' => 3),
+ array('msg_id' => 1, 'user_id' => 4),
+ array('msg_id' => 2, 'user_id' => 2),
+ array('msg_id' => 2, 'user_id' => 4),
+ array('msg_id' => 3, 'user_id' => 2),
+ array('msg_id' => 4, 'user_id' => 3),
+ array('msg_id' => 5, 'user_id' => 2),
+ array('msg_id' => 5, 'user_id' => 3),
+ array('msg_id' => 5, 'user_id' => 4),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider delete_user_pms_data
+ */
+ public function test_delete_user_pms($delete_user, $remaining_privmsgs, $remaining_privmsgs_to)
+ {
+ global $db;
+
+ $db = $this->new_dbal();
+
+ phpbb_delete_user_pms($delete_user);
+
+ $sql = 'SELECT msg_id
+ FROM ' . PRIVMSGS_TABLE;
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($remaining_privmsgs, $db->sql_fetchrowset($result));
+
+ $sql = 'SELECT msg_id, user_id
+ FROM ' . PRIVMSGS_TO_TABLE;
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($remaining_privmsgs_to, $db->sql_fetchrowset($result));
+ }
+}
diff --git a/tests/privmsgs/fixtures/delete_user_pms.xml b/tests/privmsgs/fixtures/delete_user_pms.xml
new file mode 100644
index 0000000000..9a86501b7a
--- /dev/null
+++ b/tests/privmsgs/fixtures/delete_user_pms.xml
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_new_privmsg</column>
+ <column>user_unread_privmsg</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>2</value>
+ <value>sender</value>
+ <value>sender</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>pm in inbox</value>
+ <value>pm in inbox</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>pm in no box</value>
+ <value>pm in no box</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>no pms</value>
+ <value>no pms</value>
+ <value>0</value>
+ <value>0</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_privmsgs">
+ <column>msg_id</column>
+ <column>root_level</column>
+ <column>author_id</column>
+ <column>message_subject</column>
+ <column>message_text</column>
+ <column>to_address</column>
+ <column>bcc_address</column>
+ <row>
+ <value>1</value>
+ <value>0</value>
+ <value>2</value>
+ <value>#1</value>
+ <value>
+ 2 - outbox
+ 3 - inbox
+ 4 - nobox
+ </value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>0</value>
+ <value>2</value>
+ <value>#2</value>
+ <value>
+ 2 - outbox
+ 4 - nobox
+ </value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>0</value>
+ <value>2</value>
+ <value>#3</value>
+ <value>
+ 2 - outbox
+ </value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>0</value>
+ <value>2</value>
+ <value>#4</value>
+ <value>
+ 3 - nobox
+ </value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>0</value>
+ <value>2</value>
+ <value>#5</value>
+ <value>
+ 2 - outbox
+ 3 - nobox
+ 4 - nobox
+ </value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+ <table name="phpbb_privmsgs_to">
+ <column>msg_id</column>
+ <column>user_id</column>
+ <column>author_id</column>
+ <column>pm_new</column>
+ <column>pm_unread</column>
+ <column>folder_id</column>
+ <row>
+ <value>1</value>
+ <value>2</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-2</value>
+ </row>
+ <row>
+ <value>1</value>
+ <value>3</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>0</value>
+ </row>
+ <row>
+ <value>1</value>
+ <value>4</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-3</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-2</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>4</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-3</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>2</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-2</value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>3</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-3</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>2</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-2</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>3</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-3</value>
+ </row>
+ <row>
+ <value>5</value>
+ <value>4</value>
+ <value>2</value>
+ <value>0</value>
+ <value>0</value>
+ <value>-3</value>
+ </row>
+ </table>
+</dataset>