diff options
author | Nils Adermann <naderman@naderman.de> | 2011-06-10 01:37:19 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2011-06-10 01:38:11 +0200 |
commit | 70f9dec810e3104357b6cf13978cb52ea8cd8e99 (patch) | |
tree | dcec3112b4ccde24adef7cd9b5489b7fa7888b9e /tests/functions_acp | |
parent | df52801989655a2c35af971c8e82e60be5d3eeb4 (diff) | |
download | forums-70f9dec810e3104357b6cf13978cb52ea8cd8e99.tar forums-70f9dec810e3104357b6cf13978cb52ea8cd8e99.tar.gz forums-70f9dec810e3104357b6cf13978cb52ea8cd8e99.tar.bz2 forums-70f9dec810e3104357b6cf13978cb52ea8cd8e99.tar.xz forums-70f9dec810e3104357b6cf13978cb52ea8cd8e99.zip |
[ticket/10198] Verify behaviour of validate_range with multibyte strings
Using str_repeat instead of custom function to repeat characters.
PHPBB3-10198
Diffstat (limited to 'tests/functions_acp')
-rw-r--r-- | tests/functions_acp/validate_range_test.php | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/tests/functions_acp/validate_range_test.php b/tests/functions_acp/validate_range_test.php index a9c9612ad7..11b7f87957 100644 --- a/tests/functions_acp/validate_range_test.php +++ b/tests/functions_acp/validate_range_test.php @@ -8,24 +8,12 @@ */ require_once dirname(__FILE__) . '/../mock/lang.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; require_once dirname(__FILE__) . '/../../phpBB/includes/functions_acp.php'; class phpbb_functions_acp_validate_range_test extends phpbb_test_case { /** - * Helper function which returns a string in a given length. - */ - static public function return_string($length) - { - $string = ''; - for ($i = 0; $i < $length; $i++) - { - $string .= 'a'; - } - return $string; - } - - /** * Data sets that don't throw an error. */ public function validate_range_data_fit() @@ -53,8 +41,10 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case array(array(array('column_type' => 'TINT:-32:64', 'lang' => 'TEST', 'value' => 16))), array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => ''))), - array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => self::return_string(255)))), - array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => self::return_string(128)))), + array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat('a', 255)))), + array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat("\xC3\x84", 255)))), + array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => str_repeat('a', 128)))), + array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => str_repeat("\xC3\x84", 128)))), ); } @@ -157,8 +147,10 @@ class phpbb_functions_acp_validate_range_test extends phpbb_test_case public function validate_range_data_too_long() { return array( - array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => self::return_string(256)))), - array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => self::return_string(129)))), + array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat('a', 256)))), + array(array(array('column_type' => 'VCHAR', 'lang' => 'TEST', 'value' => str_repeat("\xC3\x84", 256)))), + array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => str_repeat('a', 129)))), + array(array(array('column_type' => 'VCHAR:128', 'lang' => 'TEST', 'value' => str_repeat("\xC3\x84", 129)))), ); } |