mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 16:27:38 +02:00
[ticket/11579] Rework calls to validate_data_helper
PHPBB3-11579
This commit is contained in:
@@ -20,19 +20,17 @@ class phpbb_functions_validate_data_helper extends PHPUnit_Framework_TestCase
|
||||
* Test provided input data with supplied checks and compare to expected
|
||||
* results
|
||||
*
|
||||
* @param array $expected Array containing the expected results. Either
|
||||
* an array containing the error message or the an empty
|
||||
* array if input is correct
|
||||
* @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 $data Array containing one or more subarrays with the
|
||||
* test data. The first element of a subarray is the
|
||||
* expected result, the second one is the input, and the
|
||||
* third is the data that should be passed to the function
|
||||
* validate_data().
|
||||
*/
|
||||
public function assert_validate_data($expected, $input, $validate_check)
|
||||
public function assert_valid_data($data)
|
||||
{
|
||||
foreach ($input as $key => $data)
|
||||
foreach ($data as $key => $test)
|
||||
{
|
||||
$this->test_case->assertEquals($expected[$key], validate_data(array($data), array($validate_check[$key])));
|
||||
$this->test_case->assertEquals($test[0], validate_data(array($test[1]), array($test[2])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user