Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
7.46% |
5 / 67 |
|
66.67% |
2 / 3 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_functions_language_select_test | |
7.46% |
5 / 67 |
|
66.67% |
2 / 3 |
10.13 | |
0.00% |
0 / 1 |
| getDataSet | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| language_select_data | |
0.00% |
0 / 62 |
|
0.00% |
0 / 1 |
2 | |||
| test_language_select | |
100.00% |
4 / 4 |
|
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_language_select_test extends phpbb_database_test_case |
| 15 | { |
| 16 | public function getDataSet() |
| 17 | { |
| 18 | return $this->createXMLDataSet(__DIR__.'/fixtures/language_select.xml'); |
| 19 | } |
| 20 | |
| 21 | public static function language_select_data() |
| 22 | { |
| 23 | return [ |
| 24 | [ |
| 25 | '', |
| 26 | [ |
| 27 | [ |
| 28 | 'selected' => false, |
| 29 | 'value' => 'cs', |
| 30 | 'label' => 'Čeština', |
| 31 | ], |
| 32 | [ |
| 33 | 'selected' => false, |
| 34 | 'value' => 'en', |
| 35 | 'label' => 'English', |
| 36 | ], |
| 37 | ] |
| 38 | ], |
| 39 | [ |
| 40 | 'en', |
| 41 | [ |
| 42 | [ |
| 43 | 'selected' => false, |
| 44 | 'value' => 'cs', |
| 45 | 'label' => 'Čeština', |
| 46 | ], |
| 47 | [ |
| 48 | 'selected' => true, |
| 49 | 'value' => 'en', |
| 50 | 'label' => 'English', |
| 51 | ], |
| 52 | ] |
| 53 | ], |
| 54 | [ |
| 55 | 'cs', |
| 56 | [ |
| 57 | [ |
| 58 | 'selected' => true, |
| 59 | 'value' => 'cs', |
| 60 | 'label' => 'Čeština', |
| 61 | ], |
| 62 | [ |
| 63 | 'selected' => false, |
| 64 | 'value' => 'en', |
| 65 | 'label' => 'English', |
| 66 | ], |
| 67 | ] |
| 68 | ], |
| 69 | [ |
| 70 | 'de', |
| 71 | [ |
| 72 | [ |
| 73 | 'selected' => false, |
| 74 | 'value' => 'cs', |
| 75 | 'label' => 'Čeština', |
| 76 | ], |
| 77 | [ |
| 78 | 'selected' => false, |
| 79 | 'value' => 'en', |
| 80 | 'label' => 'English', |
| 81 | ], |
| 82 | ] |
| 83 | ], |
| 84 | ]; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * @dataProvider language_select_data |
| 89 | */ |
| 90 | public function test_language_select($default, $expected) |
| 91 | { |
| 92 | global $db; |
| 93 | $db = $this->new_dbal(); |
| 94 | |
| 95 | $lang_options = phpbb_language_select($db, $default); |
| 96 | |
| 97 | $this->assertEquals($expected, $lang_options); |
| 98 | } |
| 99 | } |