diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-05-30 20:34:21 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-05-30 20:34:21 +0200 |
commit | 33a0859f4ac3454c12dda651f708e16fc6c45adb (patch) | |
tree | ebbd521bd4db2d2e16fb0c2f0f00bffd70cce311 /tests/functions/common_validate_data.php | |
parent | 6d5da402ecfe686a918608875eda8d0d817d4c07 (diff) | |
download | forums-33a0859f4ac3454c12dda651f708e16fc6c45adb.tar forums-33a0859f4ac3454c12dda651f708e16fc6c45adb.tar.gz forums-33a0859f4ac3454c12dda651f708e16fc6c45adb.tar.bz2 forums-33a0859f4ac3454c12dda651f708e16fc6c45adb.tar.xz forums-33a0859f4ac3454c12dda651f708e16fc6c45adb.zip |
[ticket/11579] Move tests into seperate files depending on needed fixture
PHPBB3-11579
Diffstat (limited to 'tests/functions/common_validate_data.php')
-rw-r--r-- | tests/functions/common_validate_data.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/functions/common_validate_data.php b/tests/functions/common_validate_data.php new file mode 100644 index 0000000000..64c9499ac3 --- /dev/null +++ b/tests/functions/common_validate_data.php @@ -0,0 +1,31 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +class phpbb_functions_common_validate_data extends phpbb_test_case +{ + /** + * Test provided input data with supplied checks and compare to expected + * results + * + * @param array $input Input data with specific array keys that need to + * be matched by the ones in the other 2 params + * @param array $validate_check Array containing validate_data check + * settings, i.e. array('foobar' => array('string')) + * @param array $expected Array containing the expected results. Either + * an array containing the error message or the an empty + * array if input is correct + */ + public function validate_data_check($input, $validate_check, $expected) + { + foreach ($input as $key => $data) + { + $this->assertEquals($expected[$key], validate_data(array($data), array($validate_check[$key]))); + } + } +} |