Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
7.14% covered (danger)
7.14%
1 / 14
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
phpbb_functions_content_phpbb_clean_search_string_test
7.14% covered (danger)
7.14%
1 / 14
50.00% covered (danger)
50.00%
1 / 2
5.20
0.00% covered (danger)
0.00%
0 / 1
 phpbb_clean_search_string_data
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
 test_phpbb_clean_search_string
100.00% covered (success)
100.00%
1 / 1
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
14class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_case
15{
16    public static function phpbb_clean_search_string_data()
17    {
18        return array(
19            array('*', ''),
20            array('* *', ''),
21            array('test', 'test'),
22            array(' test ', 'test'),
23            array(' test * ', 'test'),
24            array('test* *', 'test*'),
25            array('* *test*', '*test*'),
26            array('test  test  * test', 'test test test'),
27            array(' some  wild*cards *    between wo*rds  ', 'some wild*cards between wo*rds'),
28            array(' we * now have*** multiple wild***cards * ', 'we now have* multiple wild*cards'),
29            array('pi is *** . * **** * *****', 'pi is .'),
30        );
31    }
32
33    /**
34    * @dataProvider phpbb_clean_search_string_data
35    */
36    public function test_phpbb_clean_search_string($search_string, $expected)
37    {
38        $this->assertEquals($expected, phpbb_clean_search_string($search_string));
39    }
40}