Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_functions_validate_data_helper
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
2 / 2
3
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 assert_valid_data
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
2
1<?php
2/**
3*
4* This file is part of the phpBB Forum Software package.
5*
6* @copyright (c) phpBB Limited <https://www.phpbb.com>
7* @license GNU General Public License, version 2 (GPL-2.0)
8*
9* For full copyright and license information, please see
10* the docs/CREDITS.txt file.
11*
12*/
13
14class phpbb_functions_validate_data_helper
15{
16    protected $test_case;
17
18    public function __construct($test_case)
19    {
20        $this->test_case = $test_case;
21    }
22
23    /**
24    * Test provided input data with supplied checks and compare to expected
25    * results
26    *
27    * @param array $data Array containing one or more subarrays with the
28    *        test data. The first element of a subarray is the
29    *        expected result, the second one is the input, and the
30    *        third is the data that should be passed to the function
31    *        validate_data().
32    */
33    public function assert_valid_data($data)
34    {
35        foreach ($data as $key => $test)
36        {
37            $this->test_case->assertEquals($test[0], validate_data(array($test[1]), array($test[2])));
38        }
39    }
40}