aboutsummaryrefslogtreecommitdiffstats
path: root/tests/user
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2013-03-06 07:35:47 +0100
committerJoas Schilling <nickvergessen@gmx.de>2013-03-06 07:35:47 +0100
commit0bbde4c12291de7c2effdfbce2f87b212190799e (patch)
tree917287070d7cabc4e419939033fa6133e028627b /tests/user
parent001572f76425a1fdb6621d26dae875438152cc97 (diff)
parent597c16a9363858e343480f70b1852bce2bba5ca3 (diff)
downloadforums-0bbde4c12291de7c2effdfbce2f87b212190799e.tar
forums-0bbde4c12291de7c2effdfbce2f87b212190799e.tar.gz
forums-0bbde4c12291de7c2effdfbce2f87b212190799e.tar.bz2
forums-0bbde4c12291de7c2effdfbce2f87b212190799e.tar.xz
forums-0bbde4c12291de7c2effdfbce2f87b212190799e.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into ticket/11166
* 'develop' of https://github.com/phpbb/phpbb3: (799 commits) [ticket/11402] Fix undefined index in post/topic_in_queue [ticket/11400] If email is disabled, disable it for notifications [ticket/11398] Correctly call permission_set method in permission tool [ticket/11394] Relax Migration Tools [ticket/11386] Fix missing ; [ticket/10714] Get log from container in install, update and download/file [feature/avatars] Update module_auth of ucp module and fix small issues [ticket/11396] Rename insert_migration to set_migration_state [ticket/11395] Prevent acp_modules::get_modules_info from reincluding files [ticket/11393] Give more information on database updater [ticket/11386] Send list of migrations instead of using load_migrations [feature/avatars] Add migrations data file for avatars [feature/avatars] Reduce module auth of ucp avatar settings [ticket/10714] Use $phpbb_adm_relative_path instead of hardcoded adm/ [ticket/10714] Logs are disabled for this page call only [ticket/6723] Show info that message has been deleted before delivery [ticket/11385] Fix issue with migration module tool not getting extension module info [ticket/11386] Fix failing tests from constructor changes [ticket/11386] Fix circular reference error & serialize error [ticket/11386] Remove tests that check if finder cache is working ... Conflicts: phpBB/assets/javascript/core.js
Diffstat (limited to 'tests/user')
-rw-r--r--tests/user/fixtures/user_loader.xml23
-rw-r--r--tests/user/user_loader.php49
2 files changed, 72 insertions, 0 deletions
diff --git a/tests/user/fixtures/user_loader.xml b/tests/user/fixtures/user_loader.xml
new file mode 100644
index 0000000000..737376f326
--- /dev/null
+++ b/tests/user/fixtures/user_loader.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <row>
+ <value>1</value>
+ <value>Guest</value>
+ <value>guest</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>Admin</value>
+ <value>admin</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>Test</value>
+ <value>test</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/user/user_loader.php b/tests/user/user_loader.php
new file mode 100644
index 0000000000..0beb804729
--- /dev/null
+++ b/tests/user/user_loader.php
@@ -0,0 +1,49 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2011 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+include_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php');
+
+class phpbb_user_lang_test extends phpbb_database_test_case
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_loader.xml');
+ }
+
+ public function test_user_loader()
+ {
+ $db = $this->new_dbal();
+
+ $user_loader = new phpbb_user_loader($db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users');
+
+ $user_loader->load_users(array(2));
+
+ $user = $user_loader->get_user(1);
+ $this->assertEquals(1, $user['user_id']);
+ $this->assertEquals('Guest', $user['username']);
+
+ $user = $user_loader->get_user(2);
+ $this->assertEquals(2, $user['user_id']);
+ $this->assertEquals('Admin', $user['username']);
+
+ // Not loaded
+ $user = $user_loader->get_user(3);
+ $this->assertEquals(1, $user['user_id']);
+ $this->assertEquals('Guest', $user['username']);
+
+ $user = $user_loader->get_user(3, true);
+ $this->assertEquals(3, $user['user_id']);
+ $this->assertEquals('Test', $user['username']);
+
+ $user_id = $user_loader->load_user_by_username('Test');
+ $user = $user_loader->get_user($user_id);
+ $this->assertEquals(3, $user['user_id']);
+ $this->assertEquals('Test', $user['username']);
+ }
+}