2013-05-30 20:34:21 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package testing
|
|
|
|
* @copyright (c) 2013 phpBB Group
|
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-06-05 17:05:10 +02:00
|
|
|
class phpbb_functions_validate_data_helper
|
2013-05-30 20:34:21 +02:00
|
|
|
{
|
2013-06-03 16:06:11 +02:00
|
|
|
protected $test_case;
|
|
|
|
|
|
|
|
public function __construct($test_case)
|
|
|
|
{
|
|
|
|
$this->test_case = $test_case;
|
|
|
|
}
|
|
|
|
|
2013-05-30 20:34:21 +02:00
|
|
|
/**
|
|
|
|
* Test provided input data with supplied checks and compare to expected
|
|
|
|
* results
|
|
|
|
*
|
2013-06-03 21:30:13 +02:00
|
|
|
* @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().
|
2013-05-30 20:34:21 +02:00
|
|
|
*/
|
2013-06-03 21:30:13 +02:00
|
|
|
public function assert_valid_data($data)
|
2013-05-30 20:34:21 +02:00
|
|
|
{
|
2013-06-03 21:30:13 +02:00
|
|
|
foreach ($data as $key => $test)
|
2013-05-30 20:34:21 +02:00
|
|
|
{
|
2013-06-03 21:30:13 +02:00
|
|
|
$this->test_case->assertEquals($test[0], validate_data(array($test[1]), array($test[2])));
|
2013-05-30 20:34:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|