Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_regex_url_test | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
4.68 | |
0.00% |
0 / 1 |
| url_test_data | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| test_url | |
100.00% |
1 / 1 |
|
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 | |
| 14 | class phpbb_regex_url_test extends phpbb_test_case |
| 15 | { |
| 16 | public static function url_test_data() |
| 17 | { |
| 18 | return array( |
| 19 | array('http://www.phpbb.com/community/', 1), |
| 20 | array('http://www.phpbb.com/path/file.ext#section', 1), |
| 21 | array('ftp://ftp.phpbb.com/', 1), |
| 22 | array('sip://bantu@phpbb.com', 1), |
| 23 | |
| 24 | array('www.phpbb.com/community/', 0), |
| 25 | ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * @dataProvider url_test_data |
| 30 | */ |
| 31 | public function test_url($url, $expected) |
| 32 | { |
| 33 | $this->assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#iu', $url)); |
| 34 | } |
| 35 | } |