1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-02 13:47:55 +02:00

[ticket/9040] Minor cleanup in the unit test file

PHPBB3-9040
This commit is contained in:
Shitiz Garg 2014-03-17 16:01:57 +05:30
parent 403ab49716
commit 8a48f6e267

View File

@ -2,7 +2,7 @@
/** /**
* *
* @package testing * @package testing
* @copyright (c) 2011 phpBB Group * @copyright (c) 2014 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
* *
*/ */
@ -28,49 +28,49 @@ class phpbb_profile_custom_string_test extends phpbb_database_test_case
'H3110', 'H3110',
'[0-9]+', '[0-9]+',
'FIELD_INVALID_CHARS_NUMBERS_ONLY-field', 'FIELD_INVALID_CHARS_NUMBERS_ONLY-field',
'Required field should reject characters in a numbers-only field' 'Required field should reject characters in a numbers-only field',
), ),
array( array(
1, 1,
'This string is too long', 'This string is too long',
'.*', '.*',
'FIELD_TOO_LONG-10-field', 'FIELD_TOO_LONG-10-field',
'Required field should reject a field too long' 'Required field should reject a field too long',
), ),
array( array(
0, 0,
'<>"&%&><>', '<>"&%&><>',
'.*', '.*',
false, false,
'Optional field should accept html entities' 'Optional field should accept html entities',
), ),
array( array(
1, 1,
'ö ä ü ß', 'ö ä ü ß',
'.*', '.*',
false, false,
'Required field should accept UTF-8 string' 'Required field should accept UTF-8 string',
), ),
array( array(
1, 1,
'This ö ä string has to b', 'This ö ä string has to b',
'.*', '.*',
'FIELD_TOO_LONG-10-field', 'FIELD_TOO_LONG-10-field',
'Required field should reject an UTF-8 string which is too long' 'Required field should reject an UTF-8 string which is too long',
), ),
array( array(
1, 1,
'ö äö äö ä', 'ö äö äö ä',
'[\w]+', '[\w]+',
'FIELD_INVALID_CHARS_ALPHA_ONLY-field', 'FIELD_INVALID_CHARS_ALPHA_ONLY-field',
'Required field should reject UTF-8 in alpha only field' 'Required field should reject UTF-8 in alpha only field',
), ),
array( array(
1, 1,
'Hello', 'Hello',
'[\w]+', '[\w]+',
false, false,
'Required field should accept a characters only field' 'Required field should accept a characters only field',
), ),
); );
} }
@ -80,14 +80,13 @@ class phpbb_profile_custom_string_test extends phpbb_database_test_case
*/ */
public function test_string_validate($field_required, $field_value, $field_validation, $expected, $description) public function test_string_validate($field_required, $field_value, $field_validation, $expected, $description)
{ {
global $db;
$db = $this->new_dbal(); $db = $this->new_dbal();
$field_data = array( $field_data = array(
'field_id' => 1, 'field_id' => 1,
'lang_id' => 1, 'lang_id' => 1,
'lang_name' => 'field', 'lang_name' => 'field',
'field_novalue' => 1, 'field_novalue' => 1,
'field_required' => $field_required, 'field_required' => $field_required,
'field_maxlen' => 10, 'field_maxlen' => 10,
'field_validation' => $field_validation, 'field_validation' => $field_validation,