From 757fcd3e63535f9fda68cf359f849a44059c7b27 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 10 Sep 2011 03:38:01 +0200 Subject: [ticket/10345] Add a system to allow multiple plural forms See http://wiki.phpbb.com/Plural_Rules for explanation and examples. PHPBB3-10345 --- tests/user/lang_test.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 6c60583a7b..11e981bb7b 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -54,5 +54,23 @@ class phpbb_user_lang_test extends phpbb_test_case // Bug PHPBB3-9949 $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); + + // Bug PHPBB3-10345 + $user = new user; + $user->lang = array( + 'PLURAL_RULE' => 13, + 'ARRY' => array( + 0 => '%d is 0', // 0 + 1 => '%d is 1', // 1 + 2 => '%d ends with 01-10', // ending with 01-10 + 3 => '%d ends with 11-19', // ending with 11-19 + 4 => '%d is part of the last rule', // everything else + ), + ); + $this->assertEquals($user->lang('ARRY', 0), '0 is 0'); + $this->assertEquals($user->lang('ARRY', 1), '1 is 1'); + $this->assertEquals($user->lang('ARRY', 103), '103 ends with 01-10'); + $this->assertEquals($user->lang('ARRY', 15), '15 ends with 11-19'); + $this->assertEquals($user->lang('ARRY', 300), '300 is part of the last rule'); } } -- cgit v1.2.1 From f16d72fcfb9a7621bf64b82cc2c710c6e484d965 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Sep 2011 01:46:00 +0200 Subject: [ticket/10345] Fix documentation on the new function and the switch Also do not min/max the value, but throw an error on an invalid Plural rule. PHPBB3-10345 --- tests/user/lang_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 11e981bb7b..90b0cdfb0f 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -51,11 +51,11 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 2), '2 posts'); $this->assertEquals($user->lang('ARRY', 123), '123 posts'); - // Bug PHPBB3-9949 + // ticket PHPBB3-9949 $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); - // Bug PHPBB3-10345 + // ticket PHPBB3-10345 $user = new user; $user->lang = array( 'PLURAL_RULE' => 13, -- cgit v1.2.1 From 2de7153afd428f44d1c4c012ffe0bf072e449c64 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 01:39:21 +0200 Subject: [ticket/10345] Allow float as array key and add some tests Added tests for the fallback when a key is missing and the float-feature. PHPBB3-10345 --- tests/user/lang_test.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 90b0cdfb0f..971a9475f0 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -26,6 +26,14 @@ class phpbb_user_lang_test extends phpbb_test_case 1 => '1 post', // 1 2 => '%d posts', // 2+ ), + 'ARRY_NO_ZERO' => array( + 1 => '1 post', // 1 + 2 => '%d posts', // 0, 2+ + ), + 'ARRY_FLOAT' => array( + 1 => '1 post', // 1.x + 2 => '%1$.1f posts', // 0.x, 2+.x + ), ); // No param @@ -51,6 +59,16 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 2), '2 posts'); $this->assertEquals($user->lang('ARRY', 123), '123 posts'); + // Array with missing keys + $this->assertEquals($user->lang('ARRY_NO_ZERO', 0), '0 posts'); + $this->assertEquals($user->lang('ARRY_NO_ZERO', 1), '1 post'); + $this->assertEquals($user->lang('ARRY_NO_ZERO', 2), '2 posts'); + + // Floats as array key + $this->assertEquals($user->lang('ARRY_FLOAT', 1.3), '1 post'); + $this->assertEquals($user->lang('ARRY_FLOAT', 2.0), '2.0 posts'); + $this->assertEquals($user->lang('ARRY_FLOAT', 2.51), '2.5 posts'); + // ticket PHPBB3-9949 $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); -- cgit v1.2.1 From 814220f1c13ecac42f9d9aceb4489d5db282b2ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 20 Sep 2011 23:06:43 +0200 Subject: [ticket/10345] Add tests for array() as first parameter on call to $user->lang() PHPBB3-10345 --- tests/user/lang_test.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 971a9475f0..ffc3ea1302 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -34,6 +34,12 @@ class phpbb_user_lang_test extends phpbb_test_case 1 => '1 post', // 1.x 2 => '%1$.1f posts', // 0.x, 2+.x ), + 'dateformat' => array( + 'AGO' => array( + 1 => '%d second', + 2 => '%d seconds', + ), + ), ); // No param @@ -69,11 +75,14 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY_FLOAT', 2.0), '2.0 posts'); $this->assertEquals($user->lang('ARRY_FLOAT', 2.51), '2.5 posts'); - // ticket PHPBB3-9949 + // Use sub key, if first paramenter is an array + $this->assertEquals($user->lang(array('dateformat', 'AGO'), 2), '2 seconds'); + + // ticket PHPBB3-9949 - use first int to determinate the plural-form to use $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); - // ticket PHPBB3-10345 + // ticket PHPBB3-10345 - different plrual rules, not just 0/1/2+ $user = new user; $user->lang = array( 'PLURAL_RULE' => 13, -- cgit v1.2.1 From 33e3bf4f64c3c2734bf97bcb204255cfdab37773 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 21 Sep 2011 00:36:18 +0200 Subject: [ticket/10345] Make the use of the 0-case optional And correctly determinate the rule otherwise PHPBB3-10345 --- tests/user/lang_test.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index ffc3ea1302..bf36811f89 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -30,6 +30,10 @@ class phpbb_user_lang_test extends phpbb_test_case 1 => '1 post', // 1 2 => '%d posts', // 0, 2+ ), + 'ARRY_MISSING' => array( + 1 => '%d post', // 1 + //Missing second plural + ), 'ARRY_FLOAT' => array( 1 => '1 post', // 1.x 2 => '%1$.1f posts', // 0.x, 2+.x @@ -65,11 +69,14 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 2), '2 posts'); $this->assertEquals($user->lang('ARRY', 123), '123 posts'); - // Array with missing keys + // No 0 key defined $this->assertEquals($user->lang('ARRY_NO_ZERO', 0), '0 posts'); $this->assertEquals($user->lang('ARRY_NO_ZERO', 1), '1 post'); $this->assertEquals($user->lang('ARRY_NO_ZERO', 2), '2 posts'); + // Array with missing keys + $this->assertEquals($user->lang('ARRY_MISSING', 2), '2 post'); + // Floats as array key $this->assertEquals($user->lang('ARRY_FLOAT', 1.3), '1 post'); $this->assertEquals($user->lang('ARRY_FLOAT', 2.0), '2.0 posts'); -- cgit v1.2.1 From 6c69bdb734af377d91c514bb42d473bc2940c177 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 15:46:08 +0100 Subject: [ticket/10345] Fix little type in unit test PHPBB3-10345 --- tests/user/lang_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index bf36811f89..36933a84d2 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -89,7 +89,7 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 1, 2), '1 post'); $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); - // ticket PHPBB3-10345 - different plrual rules, not just 0/1/2+ + // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ $user = new user; $user->lang = array( 'PLURAL_RULE' => 13, -- cgit v1.2.1 From 65e6ab55302e5d0c30fa86e06a460fed8167b84a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 30 Nov 2011 21:23:00 +0100 Subject: [ticket/10345] Return the language key when the key has an empty array PHPBB3-10345 --- tests/user/lang_test.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 36933a84d2..ee1be3c323 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -38,6 +38,8 @@ class phpbb_user_lang_test extends phpbb_test_case 1 => '1 post', // 1.x 2 => '%1$.1f posts', // 0.x, 2+.x ), + 'ARRY_EMPTY' => array( + ), 'dateformat' => array( 'AGO' => array( 1 => '%d second', @@ -69,6 +71,9 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 2), '2 posts'); $this->assertEquals($user->lang('ARRY', 123), '123 posts'); + // Empty array returns the language key + $this->assertEquals($user->lang('ARRY_EMPTY', 123), 'ARRY_EMPTY'); + // No 0 key defined $this->assertEquals($user->lang('ARRY_NO_ZERO', 0), '0 posts'); $this->assertEquals($user->lang('ARRY_NO_ZERO', 1), '1 post'); -- cgit v1.2.1 From 6deb7b3671c29ab7ce1db6e11b5c6be0950d265f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 31 Mar 2012 02:50:19 +0200 Subject: [feature/class-prefix] Rename user and session to phpbb_* PHPBB-10609 --- tests/user/lang_test.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index f0ea76f342..d7ff451a70 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -7,13 +7,11 @@ * */ -require_once dirname(__FILE__) . '/../../phpBB/includes/session.php'; - class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() { - $user = new user; + $user = new phpbb_user; $user->lang = array( 'FOO' => 'BAR', 'BARZ' => 'PENG', @@ -95,7 +93,7 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ - $user = new user; + $user = new phpbb_user; $user->lang = array( 'PLURAL_RULE' => 13, 'ARRY' => array( -- cgit v1.2.1 From 6b7443adacfa8e79304e4c91ca02000d25259633 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 8 Dec 2012 13:41:44 -0600 Subject: [ticket/11103] User loader test.bat PHPBB3-11103 --- tests/user/fixtures/user_loader.xml | 23 ++++++++++++++++++ tests/user/user_loader.php | 48 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/user/fixtures/user_loader.xml create mode 100644 tests/user/user_loader.php (limited to 'tests/user') 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 @@ + + + + user_id + username + username_clean + + 1 + Guest + guest + + + 2 + Admin + admin + + + 3 + Test + test + +
+
diff --git a/tests/user/user_loader.php b/tests/user/user_loader.php new file mode 100644 index 0000000000..145bfc9549 --- /dev/null +++ b/tests/user/user_loader.php @@ -0,0 +1,48 @@ +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_loader->load_users(array(3)); + + $user = $user_loader->get_user(2); + $this->assertEquals(2, $user['user_id']); + $this->assertEquals('Admin', $user['username']); + + $user = $user_loader->get_user(3); + $this->assertEquals(3, $user['user_id']); + $this->assertEquals('Test', $user['username']); + } +} -- cgit v1.2.1 From 37565f37e4363f257a160145bc7973a2d5738a86 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 8 Dec 2012 18:40:41 -0600 Subject: [ticket/11103] Some improvements to the user loader PHPBB3-11103 --- tests/user/user_loader.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'tests/user') diff --git a/tests/user/user_loader.php b/tests/user/user_loader.php index 145bfc9549..0beb804729 100644 --- a/tests/user/user_loader.php +++ b/tests/user/user_loader.php @@ -7,6 +7,8 @@ * */ +include_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php'); + class phpbb_user_lang_test extends phpbb_database_test_case { public function getDataSet() @@ -18,7 +20,7 @@ class phpbb_user_lang_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $user_loader = new phpbb_user_loader($db, __DIR__ . '../../phpBB', 'php', 'phpbb_users'); + $user_loader = new phpbb_user_loader($db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); $user_loader->load_users(array(2)); @@ -35,13 +37,12 @@ class phpbb_user_lang_test extends phpbb_database_test_case $this->assertEquals(1, $user['user_id']); $this->assertEquals('Guest', $user['username']); - $user_loader->load_users(array(3)); - - $user = $user_loader->get_user(2); - $this->assertEquals(2, $user['user_id']); - $this->assertEquals('Admin', $user['username']); + $user = $user_loader->get_user(3, true); + $this->assertEquals(3, $user['user_id']); + $this->assertEquals('Test', $user['username']); - $user = $user_loader->get_user(3); + $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']); } -- cgit v1.2.1 From eabcbb9baf7d69cfae6d23f05b062002d054424c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Mar 2013 01:25:10 +0100 Subject: [ticket/11441] Add _test prefix to user loader test filename. PHPBB3-11441 --- tests/user/user_loader.php | 49 ----------------------------------------- tests/user/user_loader_test.php | 49 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 tests/user/user_loader.php create mode 100644 tests/user/user_loader_test.php (limited to 'tests/user') diff --git a/tests/user/user_loader.php b/tests/user/user_loader.php deleted file mode 100644 index 0beb804729..0000000000 --- a/tests/user/user_loader.php +++ /dev/null @@ -1,49 +0,0 @@ -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']); - } -} diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php new file mode 100644 index 0000000000..0beb804729 --- /dev/null +++ b/tests/user/user_loader_test.php @@ -0,0 +1,49 @@ +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']); + } +} -- cgit v1.2.1 From 3c09612d36acf821d4d8576f165dda2e7d69d04e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Mar 2013 01:26:26 +0100 Subject: [ticket/11441] Correct/fix class name of user loader test. PHPBB3-11441 --- tests/user/user_loader_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/user') diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 0beb804729..57a86d8729 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -9,7 +9,7 @@ include_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php'); -class phpbb_user_lang_test extends phpbb_database_test_case +class phpbb_user_loader_test extends phpbb_database_test_case { public function getDataSet() { -- cgit v1.2.1 From e1e9138c3b706d686dc176f7ccb3dfc95cbf0bb4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Mar 2013 01:28:27 +0100 Subject: [ticket/11441] Update/correct copyright year of user loader test. PHPBB3-11441 --- tests/user/user_loader_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/user') diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 57a86d8729..c030e7ff97 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -2,7 +2,7 @@ /** * * @package testing -* @copyright (c) 2011 phpBB Group +* @copyright (c) 2012 phpBB Group * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From ef1caf69332bed24a12fdeda98711f5012c85ebd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Mar 2013 01:32:33 +0100 Subject: [ticket/11441] Use setUp() in phpbb_user_loader_test. PHPBB3-11441 --- tests/user/user_loader_test.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'tests/user') diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index c030e7ff97..89659256f8 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -11,38 +11,45 @@ include_once(__DIR__ . '/../../phpBB/includes/utf/utf_tools.php'); class phpbb_user_loader_test extends phpbb_database_test_case { + protected $db; + protected $user_loader; + public function getDataSet() { return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_loader.xml'); } - public function test_user_loader() + public function setUp() { - $db = $this->new_dbal(); + parent::setUp(); - $user_loader = new phpbb_user_loader($db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); + $this->db = $this->new_dbal(); + $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); + } - $user_loader->load_users(array(2)); + public function test_user_loader() + { + $this->user_loader->load_users(array(2)); - $user = $user_loader->get_user(1); + $user = $this->user_loader->get_user(1); $this->assertEquals(1, $user['user_id']); $this->assertEquals('Guest', $user['username']); - $user = $user_loader->get_user(2); + $user = $this->user_loader->get_user(2); $this->assertEquals(2, $user['user_id']); $this->assertEquals('Admin', $user['username']); // Not loaded - $user = $user_loader->get_user(3); + $user = $this->user_loader->get_user(3); $this->assertEquals(1, $user['user_id']); $this->assertEquals('Guest', $user['username']); - $user = $user_loader->get_user(3, true); + $user = $this->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); + $user_id = $this->user_loader->load_user_by_username('Test'); + $user = $this->user_loader->get_user($user_id); $this->assertEquals(3, $user['user_id']); $this->assertEquals('Test', $user['username']); } -- cgit v1.2.1 From ba460d98f1fb78da1f996ae7fcc5cc28e574d3ba Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Mar 2013 01:36:05 +0100 Subject: [ticket/11441] Split user loader tests into multiple test methods. PHPBB3-11441 --- tests/user/user_loader_test.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests/user') diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 89659256f8..5cdb654b18 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -27,7 +27,7 @@ class phpbb_user_loader_test extends phpbb_database_test_case $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); } - public function test_user_loader() + public function test_load_get() { $this->user_loader->load_users(array(2)); @@ -38,8 +38,12 @@ class phpbb_user_loader_test extends phpbb_database_test_case $user = $this->user_loader->get_user(2); $this->assertEquals(2, $user['user_id']); $this->assertEquals('Admin', $user['username']); + } + + public function test_load_get_unloaded() + { + $this->user_loader->load_users(array(2)); - // Not loaded $user = $this->user_loader->get_user(3); $this->assertEquals(1, $user['user_id']); $this->assertEquals('Guest', $user['username']); @@ -47,7 +51,10 @@ class phpbb_user_loader_test extends phpbb_database_test_case $user = $this->user_loader->get_user(3, true); $this->assertEquals(3, $user['user_id']); $this->assertEquals('Test', $user['username']); + } + public function test_load_user_by_username() + { $user_id = $this->user_loader->load_user_by_username('Test'); $user = $this->user_loader->get_user($user_id); $this->assertEquals(3, $user['user_id']); -- cgit v1.2.1 From 555f0529f2a256545d67208a2bd1af1adfb92c41 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 27 May 2013 15:47:19 +0200 Subject: [ticket/11573] Honor MySQL STRICT_TRANS_TABLES in phpbb_user_loader_test. PHPBB3-11573 --- tests/user/fixtures/user_loader.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tests/user') diff --git a/tests/user/fixtures/user_loader.xml b/tests/user/fixtures/user_loader.xml index 737376f326..1fed8b5838 100644 --- a/tests/user/fixtures/user_loader.xml +++ b/tests/user/fixtures/user_loader.xml @@ -2,22 +2,38 @@ user_id + user_permissionsusernameusername_clean + user_sig + user_occ + user_interests 1 + Guest guest + + + 2 + Admin admin + + + 3 + Test test + + +
-- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- tests/user/lang_test.php | 4 ++-- tests/user/user_loader_test.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index d7ff451a70..c7c858c59d 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -11,7 +11,7 @@ class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() { - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array( 'FOO' => 'BAR', 'BARZ' => 'PENG', @@ -93,7 +93,7 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ - $user = new phpbb_user; + $user = new \phpbb\user; $user->lang = array( 'PLURAL_RULE' => 13, 'ARRY' => array( diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 5cdb654b18..13c35030f9 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -24,7 +24,7 @@ class phpbb_user_loader_test extends phpbb_database_test_case parent::setUp(); $this->db = $this->new_dbal(); - $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); + $this->user_loader = new \phpbb\user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users'); } public function test_load_get() -- cgit v1.2.1 From d63ac61b1946d5ed96392b6aaafd656f3f4031be Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 4 Dec 2013 13:46:51 +0100 Subject: [ticket/12056] Fix "Call to undefined function phpbb\phpbb_get_plural_form()". PHPBB3-12056 --- tests/user/lang_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index c7c858c59d..9cb9e320b3 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -7,6 +7,8 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() -- cgit v1.2.1 From bbada27ee9e797c7f6ce997152bc1efb8c8f125d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 2 Feb 2014 21:45:59 +0100 Subject: [ticket/12115] Also port user interests to profile fields PHPBB3-12115 --- tests/user/fixtures/user_loader.xml | 8 -------- 1 file changed, 8 deletions(-) (limited to 'tests/user') diff --git a/tests/user/fixtures/user_loader.xml b/tests/user/fixtures/user_loader.xml index 1fed8b5838..f676f468a6 100644 --- a/tests/user/fixtures/user_loader.xml +++ b/tests/user/fixtures/user_loader.xml @@ -6,16 +6,12 @@ username username_clean user_sig - user_occ - user_interests 1 Guest guest - - 2 @@ -23,8 +19,6 @@ Admin admin - - 3 @@ -32,8 +26,6 @@ Test test - - -- cgit v1.2.1 From a759704b39fc1c1353f865a633759b1369589b67 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Tue, 27 May 2014 20:18:06 +0200 Subject: [ticket/12594] Remove @package tags and update file headers PHPBB3-12594 --- tests/user/lang_test.php | 10 +++++++--- tests/user/user_loader_test.php | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 9cb9e320b3..45c6b04c65 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php index 13c35030f9..8d1f43707b 100644 --- a/tests/user/user_loader_test.php +++ b/tests/user/user_loader_test.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From 8d99b4afe1557a6ec0e760c4876bb06a3b9991d3 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 10 Aug 2014 13:40:27 +0200 Subject: [ticket/12932] Fix tests and calls to create_datetime PHPBB3-12932 --- tests/user/lang_test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/user') diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php index 45c6b04c65..bb11bb63cb 100644 --- a/tests/user/lang_test.php +++ b/tests/user/lang_test.php @@ -17,7 +17,7 @@ class phpbb_user_lang_test extends phpbb_test_case { public function test_user_lang_sprintf() { - $user = new \phpbb\user; + $user = new \phpbb\user('\phpbb\datetime'); $user->lang = array( 'FOO' => 'BAR', 'BARZ' => 'PENG', @@ -99,7 +99,7 @@ class phpbb_user_lang_test extends phpbb_test_case $this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post'); // ticket PHPBB3-10345 - different plural rules, not just 0/1/2+ - $user = new \phpbb\user; + $user = new \phpbb\user('\phpbb\datetime'); $user->lang = array( 'PLURAL_RULE' => 13, 'ARRY' => array( -- cgit v1.2.1