Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
phpbb_functions_validate_match_test
100.00% covered (success)
100.00%
24 / 24
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 setUp
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 test_validate_match
100.00% covered (success)
100.00%
22 / 22
100.00% covered (success)
100.00%
1 / 1
1
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
14require_once __DIR__ . '/../../phpBB/includes/functions_user.php';
15require_once __DIR__ . '/validate_data_helper.php';
16
17class phpbb_functions_validate_match_test extends phpbb_test_case
18{
19    protected $helper;
20
21    protected function setUp(): void
22    {
23        parent::setUp();
24
25        $this->helper = new phpbb_functions_validate_data_helper($this);
26    }
27
28    public function test_validate_match()
29    {
30        $this->helper->assert_valid_data(array(
31            'empty_opt' => array(
32                array(),
33                '',
34                array('match', true, '/[a-z]$/'),
35            ),
36            'empty_empty_match' => array(
37                array(),
38                '',
39                array('match'),
40            ),
41            'foobar' => array(
42                array(),
43                'foobar',
44                array('match', false, '/[a-z]$/'),
45            ),
46            'foobar_fail' => array(
47                array('WRONG_DATA'),
48                'foobar123',
49                array('match', false, '/[a-z]$/'),
50            ),
51        ));
52    }
53}