Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
1.22% |
1 / 82 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functions_parse_cfg_file_test | |
1.22% |
1 / 82 |
|
50.00% |
1 / 2 |
5.86 | |
0.00% |
0 / 1 |
| parse_cfg_file_data | |
0.00% |
0 / 81 |
|
0.00% |
0 / 1 |
2 | |||
| test_parse_cfg_file | |
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_functions_parse_cfg_file_test extends phpbb_test_case |
| 15 | { |
| 16 | public static function parse_cfg_file_data() |
| 17 | { |
| 18 | return array( |
| 19 | array( |
| 20 | array( |
| 21 | '#', |
| 22 | '# phpBB Style Configuration File', |
| 23 | '#', |
| 24 | '# This file is part of the phpBB Forum Software package.', |
| 25 | '#', |
| 26 | '# @copyright (c) phpBB Limited <https://www.phpbb.com>', |
| 27 | '# @license GNU General Public License, version 2 (GPL-2.0)', |
| 28 | '#', |
| 29 | '# For full copyright and license information, please see', |
| 30 | '# the docs/CREDITS.txt file.', |
| 31 | '#', |
| 32 | '# At the left is the name, please do not change this', |
| 33 | '# At the right the value is entered', |
| 34 | '# For on/off options the valid values are on, off, 1, 0, true and false', |
| 35 | '#', |
| 36 | '# Values get trimmed, if you want to add a space in front or at the end of', |
| 37 | '# the value, then enclose the value with single or double quotes.', |
| 38 | '# Single and double quotes do not need to be escaped.', |
| 39 | '#', |
| 40 | '', |
| 41 | '# General Information about this style', |
| 42 | 'name = prosilver', |
| 43 | 'copyright = © phpBB Limited, 2007', |
| 44 | 'version = 3.0.12', |
| 45 | ), |
| 46 | array( |
| 47 | 'name' => 'prosilver', |
| 48 | 'copyright' => '© phpBB Limited, 2007', |
| 49 | 'version' => '3.0.12', |
| 50 | ), |
| 51 | ), |
| 52 | array( |
| 53 | array( |
| 54 | 'name = subsilver2', |
| 55 | 'copyright = © 2005 phpBB Limited', |
| 56 | 'version = 3.0.12', |
| 57 | ), |
| 58 | array( |
| 59 | 'name' => 'subsilver2', |
| 60 | 'copyright' => '© 2005 phpBB Limited', |
| 61 | 'version' => '3.0.12', |
| 62 | ), |
| 63 | ), |
| 64 | array( |
| 65 | array( |
| 66 | 'foo = on', |
| 67 | 'foo1 = true', |
| 68 | 'foo2 = 1', |
| 69 | 'bar = off', |
| 70 | 'bar1 = false', |
| 71 | 'bar2 = 0', |
| 72 | 'foobar =', |
| 73 | 'foobar1 = "asdf"', |
| 74 | 'foobar2 = \'qwer\'', |
| 75 | ), |
| 76 | array( |
| 77 | 'foo' => true, |
| 78 | 'foo1' => true, |
| 79 | 'foo2' => true, |
| 80 | 'bar' => false, |
| 81 | 'bar1' => false, |
| 82 | 'bar2' => false, |
| 83 | 'foobar' => '', |
| 84 | 'foobar1' => 'asdf', |
| 85 | 'foobar2' => 'qwer', |
| 86 | ), |
| 87 | ), |
| 88 | array( |
| 89 | array( |
| 90 | 'foo = & bar', |
| 91 | 'bar = <a href="test">Test</a>', |
| 92 | ), |
| 93 | array( |
| 94 | 'foo' => '&amp; bar', |
| 95 | 'bar' => '<a href="test">Test</a>', |
| 96 | ), |
| 97 | ), |
| 98 | ); |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @dataProvider parse_cfg_file_data |
| 103 | */ |
| 104 | public function test_parse_cfg_file($file_contents, $expected) |
| 105 | { |
| 106 | $this->assertEquals($expected, parse_cfg_file(false, $file_contents)); |
| 107 | } |
| 108 | } |