From 0e85704d75c2edefdbdfb9d5542ab366744e65fb Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 13 Jul 2011 00:44:10 +0200 Subject: [ticket/10243] Adding a few unit tests for phpbb_gmgetdate(). PHPBB3-10243 --- tests/wrapper/gmgetdate_test.php | 49 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 tests/wrapper/gmgetdate_test.php (limited to 'tests/wrapper') diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php new file mode 100644 index 0000000000..0b4c3378a9 --- /dev/null +++ b/tests/wrapper/gmgetdate_test.php @@ -0,0 +1,49 @@ +run_gmgetdate_assertion(); + $this->run_test_with_timezone('UTC'); + $this->run_test_with_timezone('Europe/Berlin'); + $this->run_test_with_timezone('America/Los_Angeles'); + $this->run_test_with_timezone('Antarctica/South_Pole'); + } + + protected function run_test_with_timezone($timezone_identifier) + { + $current_timezone = date_default_timezone_get(); + + date_default_timezone_set($timezone_identifier); + $this->run_gmgetdate_assertion(); + date_default_timezone_set($current_timezone); + } + + protected function run_gmgetdate_assertion() + { + $expected = time(); + + $date_array = phpbb_gmgetdate($expected); + + $actual = gmmktime( + $date_array['hours'], + $date_array['minutes'], + $date_array['seconds'], + $date_array['mon'], + $date_array['mday'], + $date_array['year'] + ); + + $this->assertEquals($expected, $actual); + } +} -- cgit v1.2.1 From e11f9afdce7649cebbe3f40d8af6ef62f8042434 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 13 Jul 2011 00:49:48 +0200 Subject: [ticket/10265] Move mt_rand.php to wrapper folder and add _test suffix. PHPBB3-10265 --- tests/wrapper/mt_rand_test.php | 46 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 tests/wrapper/mt_rand_test.php (limited to 'tests/wrapper') diff --git a/tests/wrapper/mt_rand_test.php b/tests/wrapper/mt_rand_test.php new file mode 100644 index 0000000000..c8bcb3d14c --- /dev/null +++ b/tests/wrapper/mt_rand_test.php @@ -0,0 +1,46 @@ +assertEquals(42, $result); + } + + public function test_max_equals_min_negative() + { + $result = phpbb_mt_rand(-42, -42); + $this->assertEquals(-42, $result); + } + + public function test_max_greater_min() + { + $result = phpbb_mt_rand(3, 4); + $this->assertGreaterThanOrEqual(3, $result); + $this->assertLessThanOrEqual(4, $result); + } + + public function test_min_greater_max() + { + $result = phpbb_mt_rand(4, 3); + $this->assertGreaterThanOrEqual(3, $result); + $this->assertLessThanOrEqual(4, $result); + } + + public function test_min_greater_max_negative() + { + $result = phpbb_mt_rand(-3, -4); + $this->assertGreaterThanOrEqual(-4, $result); + $this->assertLessThanOrEqual(-3, $result); + } +} -- cgit v1.2.1 From fdfd4ce5fdec03f3341a6b477e242f2674f20b1e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 13 Jul 2011 02:35:11 +0200 Subject: [ticket/10263] Adding unit tests for phpbb_version_compare(). PHPBB3-10263 --- tests/wrapper/version_compare_test.php | 130 +++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 tests/wrapper/version_compare_test.php (limited to 'tests/wrapper') diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php new file mode 100644 index 0000000000..f718cfd16b --- /dev/null +++ b/tests/wrapper/version_compare_test.php @@ -0,0 +1,130 @@ +assertEquals(-1, phpbb_version_compare('1.0.0', '1.0.1')); + $this->assertEquals(0, phpbb_version_compare('1.0.0', '1.0.0')); + $this->assertEquals(1, phpbb_version_compare('1.0.1', '1.0.0')); + } + + public function test_three_parameters() + { + $this->assertEquals(true, phpbb_version_compare('1.0.0', '1.0.1', '<')); + $this->assertEquals(true, phpbb_version_compare('1.0.0', '1.0.0', '<=')); + $this->assertEquals(true, phpbb_version_compare('1.0.0', '1.0.0', '=')); + $this->assertEquals(true, phpbb_version_compare('1.0.0', '1.0.0', '>=')); + $this->assertEquals(true, phpbb_version_compare('1.0.1', '1.0.0', '>')); + } + + public function test_strict_order() + { + $releases = array( + '2.0.0', + '2.0.1', + // Those are not version_compare() compatible + //'2.0.6a', + //'2.0.6b', + //'2.0.6c', + //'2.0.6d', + '2.0.7', + '2.0.23', + '3.0.A1', + '3.0.A2', + '3.0.A3', + '3.0.B1', + '3.0.B2', + '3.0.B4', + '3.0.B5', + '3.0.RC1', + '3.0.RC5', + '3.0.0', + '3.0.1', + '3.0.2', + '3.0.7', + '3.0.7-PL1', + '3.0.8-RC1', + '3.0.8', + '3.0.9-dev', + '3.0.9-RC1', + '3.0.9-RC2', + '3.0.9-RC4', + '3.0.10-RC1', + '3.1-dev', + '3.2-A1', + ); + + for ($i = 0, $size = sizeof($releases); $i < $size - 1; ++$i) + { + $version1 = $releases[$i]; + $version2 = $releases[$i + 1]; + + $this->assertEquals( + true, + phpbb_version_compare($version1, $version2, '<'), + "Result of version comparison $version1 < $version2 is incorrect." + ); + } + } + + /** + * @dataProvider equality_test_data + */ + public function test_equality($version1, $version2) + { + $this->assertEquals( + 0, + phpbb_version_compare($version1, $version2), + "Result of version comparison $version1 = $version2 is incorrect." + ); + + $this->assertEquals( + true, + phpbb_version_compare($version1, $version2, '='), + "Result of version comparison $version1 = $version2 is incorrect." + ); + } + + public function equality_test_data() + { + return array( + array('1.1.0-A2', '1.1.0-a2'), + array('1.1.0-B1', '1.1.0-b1'), + ); + } + + /** + * @dataProvider alpha_beta_test_data + */ + public function test_alpha_beta($expected, $version1, $version2) + { + $this->assertEquals( + $expected, + phpbb_version_compare($version1, $version2), + "Result of version comparison ($version1, $version2) = $expected is incorrect." + ); + + } + + public function alpha_beta_test_data() + { + return array( + array(-1, '1.1.0-A2', '1.1.0-B1'), + array(-1, '1.1.0-a2', '1.1.0-b1'), + + array(-1, '1.1.0-a2', '1.1.0-B1'), + array(-1, '1.1.0-A2', '1.1.0-b1'), + ); + } + +} -- cgit v1.2.1 From 17991823ea72ef973852fd9d0a9c516703f2137e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 16:05:02 +0000 Subject: [ticket/9916] Updating License in the header PHPBB3-9916 --- tests/wrapper/gmgetdate_test.php | 2 +- tests/wrapper/mt_rand_test.php | 2 +- tests/wrapper/version_compare_test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/wrapper') diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php index 0b4c3378a9..a838cfdba9 100644 --- a/tests/wrapper/gmgetdate_test.php +++ b/tests/wrapper/gmgetdate_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/mt_rand_test.php b/tests/wrapper/mt_rand_test.php index c8bcb3d14c..eba0bf2faa 100644 --- a/tests/wrapper/mt_rand_test.php +++ b/tests/wrapper/mt_rand_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/version_compare_test.php b/tests/wrapper/version_compare_test.php index f718cfd16b..8b42eb4bee 100644 --- a/tests/wrapper/version_compare_test.php +++ b/tests/wrapper/version_compare_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From afd6f86892fbbbe06aa0b1295dba361fab29fd5f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 13:22:11 +0200 Subject: [ticket/10931] Unit tests for phpbb_php_ini class. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 tests/wrapper/phpbb_php_ini_test.php (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php new file mode 100644 index 0000000000..164966fba4 --- /dev/null +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -0,0 +1,58 @@ +php_ini = new phpbb_mock_phpbb_php_ini; + } + + public function test_get_string() + { + $this->assertEquals('phpbb', $this->php_ini->get_string(' phpbb ')); + } + + public function test_get_bool() + { + $this->assertEquals(true, $this->php_ini->get_bool('ON')); + $this->assertEquals(true, $this->php_ini->get_bool('on')); + $this->assertEquals(true, $this->php_ini->get_bool('1')); + + $this->assertEquals(false, $this->php_ini->get_bool('OFF')); + $this->assertEquals(false, $this->php_ini->get_bool('off')); + $this->assertEquals(false, $this->php_ini->get_bool('0')); + $this->assertEquals(false, $this->php_ini->get_bool('')); + } + + public function test_get_int() + { + $this->assertEquals(1234, $this->php_ini->get_int('1234')); + $this->assertEquals(false, $this->php_ini->get_int('phpBB')); + } + + public function test_get_float() + { + $this->assertEquals(1234.0, $this->php_ini->get_float('1234')); + $this->assertEquals(false, $this->php_ini->get_float('phpBB')); + } + + public function test_get_bytes() + { + $this->assertEquals(false, $this->php_ini->get_bytes('phpBB')); + $this->assertEquals(false, $this->php_ini->get_bytes('M')); + $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32M')); + $this->assertEquals(8 * pow(2, 30), $this->php_ini->get_bytes('8G')); + $this->assertEquals(1234, $this->php_ini->get_bytes('1234')); + } +} -- cgit v1.2.1 From 5086366662d78d79bb6daf4b132709d9273c2f8c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 14:18:21 +0200 Subject: [ticket/10931] Make it clear that we are mocking the ini_get() function. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_fake.php | 16 ++++++++++++++++ tests/wrapper/phpbb_php_ini_test.php | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 tests/wrapper/phpbb_php_ini_fake.php (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_fake.php b/tests/wrapper/phpbb_php_ini_fake.php new file mode 100644 index 0000000000..14ec77c644 --- /dev/null +++ b/tests/wrapper/phpbb_php_ini_fake.php @@ -0,0 +1,16 @@ +php_ini = new phpbb_mock_phpbb_php_ini; + $this->php_ini = new phpbb_php_ini_fake; } public function test_get_string() -- cgit v1.2.1 From 80dfa53ee3f04dfdba11efe9eb3f49d739bb602b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 14:24:30 +0200 Subject: [ticket/10931] Correctly use GNU GPL version 2. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_fake.php | 2 +- tests/wrapper/phpbb_php_ini_test.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_fake.php b/tests/wrapper/phpbb_php_ini_fake.php index 14ec77c644..49bc5936e5 100644 --- a/tests/wrapper/phpbb_php_ini_fake.php +++ b/tests/wrapper/phpbb_php_ini_fake.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 5494f1864d..cdfee802f2 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -3,7 +3,7 @@ * * @package testing * @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From fb279c9677641db5efa38f24c51db93df004cb46 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 14:31:09 +0200 Subject: [ticket/10931] Also test lower case units in test_get_bytes(). PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index cdfee802f2..cbb05e98e9 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -50,8 +50,9 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_bytes() { $this->assertEquals(false, $this->php_ini->get_bytes('phpBB')); + $this->assertEquals(false, $this->php_ini->get_bytes('k')); $this->assertEquals(false, $this->php_ini->get_bytes('M')); - $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32M')); + $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32m')); $this->assertEquals(8 * pow(2, 30), $this->php_ini->get_bytes('8G')); $this->assertEquals(1234, $this->php_ini->get_bytes('1234')); } -- cgit v1.2.1 From 3872abd824c9371af6cbb45e6e9bbfcb31094f98 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 14:35:18 +0200 Subject: [ticket/10931] Also test for negative values. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index cbb05e98e9..84e2b5e92e 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -38,12 +38,14 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_int() { $this->assertEquals(1234, $this->php_ini->get_int('1234')); + $this->assertEquals(-12345, $this->php_ini->get_int('-12345')); $this->assertEquals(false, $this->php_ini->get_int('phpBB')); } public function test_get_float() { $this->assertEquals(1234.0, $this->php_ini->get_float('1234')); + $this->assertEquals(-12345.0, $this->php_ini->get_float('-12345')); $this->assertEquals(false, $this->php_ini->get_float('phpBB')); } @@ -51,9 +53,14 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case { $this->assertEquals(false, $this->php_ini->get_bytes('phpBB')); $this->assertEquals(false, $this->php_ini->get_bytes('k')); + $this->assertEquals(false, $this->php_ini->get_bytes('-k')); $this->assertEquals(false, $this->php_ini->get_bytes('M')); + $this->assertEquals(false, $this->php_ini->get_bytes('-M')); $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32m')); + $this->assertEquals(- 32 * pow(2, 20), $this->php_ini->get_bytes('-32m')); $this->assertEquals(8 * pow(2, 30), $this->php_ini->get_bytes('8G')); + $this->assertEquals(- 8 * pow(2, 30), $this->php_ini->get_bytes('-8G')); $this->assertEquals(1234, $this->php_ini->get_bytes('1234')); + $this->assertEquals(-12345, $this->php_ini->get_bytes('-12345')); } } -- cgit v1.2.1 From 44287e57bf9536bd91933347ad64f289ef2a0391 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 14:43:50 +0200 Subject: [ticket/10931] Use strict assertSame() instead of assertEquals(). PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 38 ++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 84e2b5e92e..5c312300d3 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -20,42 +20,42 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_string() { - $this->assertEquals('phpbb', $this->php_ini->get_string(' phpbb ')); + $this->assertSame('phpbb', $this->php_ini->get_string(' phpbb ')); } public function test_get_bool() { - $this->assertEquals(true, $this->php_ini->get_bool('ON')); - $this->assertEquals(true, $this->php_ini->get_bool('on')); - $this->assertEquals(true, $this->php_ini->get_bool('1')); + $this->assertSame(true, $this->php_ini->get_bool('ON')); + $this->assertSame(true, $this->php_ini->get_bool('on')); + $this->assertSame(true, $this->php_ini->get_bool('1')); - $this->assertEquals(false, $this->php_ini->get_bool('OFF')); - $this->assertEquals(false, $this->php_ini->get_bool('off')); - $this->assertEquals(false, $this->php_ini->get_bool('0')); - $this->assertEquals(false, $this->php_ini->get_bool('')); + $this->assertSame(false, $this->php_ini->get_bool('OFF')); + $this->assertSame(false, $this->php_ini->get_bool('off')); + $this->assertSame(false, $this->php_ini->get_bool('0')); + $this->assertSame(false, $this->php_ini->get_bool('')); } public function test_get_int() { - $this->assertEquals(1234, $this->php_ini->get_int('1234')); - $this->assertEquals(-12345, $this->php_ini->get_int('-12345')); - $this->assertEquals(false, $this->php_ini->get_int('phpBB')); + $this->assertSame(1234, $this->php_ini->get_int('1234')); + $this->assertSame(-12345, $this->php_ini->get_int('-12345')); + $this->assertSame(false, $this->php_ini->get_int('phpBB')); } public function test_get_float() { - $this->assertEquals(1234.0, $this->php_ini->get_float('1234')); - $this->assertEquals(-12345.0, $this->php_ini->get_float('-12345')); - $this->assertEquals(false, $this->php_ini->get_float('phpBB')); + $this->assertSame(1234.0, $this->php_ini->get_float('1234')); + $this->assertSame(-12345.0, $this->php_ini->get_float('-12345')); + $this->assertSame(false, $this->php_ini->get_float('phpBB')); } public function test_get_bytes() { - $this->assertEquals(false, $this->php_ini->get_bytes('phpBB')); - $this->assertEquals(false, $this->php_ini->get_bytes('k')); - $this->assertEquals(false, $this->php_ini->get_bytes('-k')); - $this->assertEquals(false, $this->php_ini->get_bytes('M')); - $this->assertEquals(false, $this->php_ini->get_bytes('-M')); + $this->assertSame(false, $this->php_ini->get_bytes('phpBB')); + $this->assertSame(false, $this->php_ini->get_bytes('k')); + $this->assertSame(false, $this->php_ini->get_bytes('-k')); + $this->assertSame(false, $this->php_ini->get_bytes('M')); + $this->assertSame(false, $this->php_ini->get_bytes('-M')); $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32m')); $this->assertEquals(- 32 * pow(2, 20), $this->php_ini->get_bytes('-32m')); $this->assertEquals(8 * pow(2, 30), $this->php_ini->get_bytes('8G')); -- cgit v1.2.1 From 09fb9a9efe048cef102471d1ce79cdeff932776a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 15:15:08 +0200 Subject: [ticket/10931] Make sure get_bytes() always returns either an int or a float. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 5c312300d3..4d8e583eb8 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -49,18 +49,35 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case $this->assertSame(false, $this->php_ini->get_float('phpBB')); } - public function test_get_bytes() + public function test_get_bytes_invalid() { $this->assertSame(false, $this->php_ini->get_bytes('phpBB')); $this->assertSame(false, $this->php_ini->get_bytes('k')); $this->assertSame(false, $this->php_ini->get_bytes('-k')); $this->assertSame(false, $this->php_ini->get_bytes('M')); $this->assertSame(false, $this->php_ini->get_bytes('-M')); - $this->assertEquals(32 * pow(2, 20), $this->php_ini->get_bytes('32m')); - $this->assertEquals(- 32 * pow(2, 20), $this->php_ini->get_bytes('-32m')); - $this->assertEquals(8 * pow(2, 30), $this->php_ini->get_bytes('8G')); - $this->assertEquals(- 8 * pow(2, 30), $this->php_ini->get_bytes('-8G')); - $this->assertEquals(1234, $this->php_ini->get_bytes('1234')); - $this->assertEquals(-12345, $this->php_ini->get_bytes('-12345')); + } + + /** + * @dataProvider get_bytes_data + */ + public function test_get_bytes($expected, $value) + { + $actual = $this->php_ini->get_bytes($value); + + $this->assertTrue(is_float($actual) || is_int($actual)); + $this->assertEquals($expected, $actual); + } + + static public function get_bytes_data() + { + return array( + array(32 * pow(2, 20), '32m'), + array(- 32 * pow(2, 20), '-32m'), + array(8 * pow(2, 30), '8G'), + array(- 8 * pow(2, 30), '-8G'), + array(1234, '1234'), + array(-12345, '-12345'), + ); } } -- cgit v1.2.1 From cbff02db4f84c83c62bdd1f7450b8afbf39a5270 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 15:22:55 +0200 Subject: [ticket/10931] Make to_numeric function globally available. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 4d8e583eb8..418448f102 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -8,6 +8,7 @@ */ require_once dirname(__FILE__) . '/phpbb_php_ini_fake.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case { -- cgit v1.2.1 From 72212077ebecee639c49c473646a38340908d058 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 11 Jun 2012 15:31:25 +0200 Subject: [ticket/10931] Also test get_bytes() and get_string() with false. PHPBB3-10931 --- tests/wrapper/phpbb_php_ini_test.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/wrapper') diff --git a/tests/wrapper/phpbb_php_ini_test.php b/tests/wrapper/phpbb_php_ini_test.php index 418448f102..8e08d5c204 100644 --- a/tests/wrapper/phpbb_php_ini_test.php +++ b/tests/wrapper/phpbb_php_ini_test.php @@ -21,6 +21,7 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_string() { + $this->assertSame(false, $this->php_ini->get_string(false)); $this->assertSame('phpbb', $this->php_ini->get_string(' phpbb ')); } @@ -52,6 +53,7 @@ class phpbb_wrapper_phpbb_php_ini_test extends phpbb_test_case public function test_get_bytes_invalid() { + $this->assertSame(false, $this->php_ini->get_bytes(false)); $this->assertSame(false, $this->php_ini->get_bytes('phpBB')); $this->assertSame(false, $this->php_ini->get_bytes('k')); $this->assertSame(false, $this->php_ini->get_bytes('-k')); -- cgit v1.2.1