diff options
author | Joas Schilling <nickvergessen@gmx.de> | 2013-05-14 15:55:05 +0200 |
---|---|---|
committer | Joas Schilling <nickvergessen@gmx.de> | 2013-05-14 20:32:36 +0200 |
commit | 6900e8dae08b4a8c1af3529a418f5156b0cfd157 (patch) | |
tree | 6d3b393e7cd777f260c764524f2b9f71f992e01a /tests/functions | |
parent | b3479869232fd4f2e6c3f43e0d6e76ee08ab7d23 (diff) | |
download | forums-6900e8dae08b4a8c1af3529a418f5156b0cfd157.tar forums-6900e8dae08b4a8c1af3529a418f5156b0cfd157.tar.gz forums-6900e8dae08b4a8c1af3529a418f5156b0cfd157.tar.bz2 forums-6900e8dae08b4a8c1af3529a418f5156b0cfd157.tar.xz forums-6900e8dae08b4a8c1af3529a418f5156b0cfd157.zip |
[ticket/11542] Add unit tests for language_select()
PHPBB3-11542
Diffstat (limited to 'tests/functions')
-rw-r--r-- | tests/functions/fixtures/language_select.xml | 18 | ||||
-rw-r--r-- | tests/functions/language_select_test.php | 38 |
2 files changed, 56 insertions, 0 deletions
diff --git a/tests/functions/fixtures/language_select.xml b/tests/functions/fixtures/language_select.xml new file mode 100644 index 0000000000..02fdee093e --- /dev/null +++ b/tests/functions/fixtures/language_select.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_lang"> + <column>lang_id</column> + <column>lang_iso</column> + <column>lang_local_name</column> + <row> + <value>1</value> + <value>en</value> + <value>English</value> + </row> + <row> + <value>2</value> + <value>de</value> + <value>Deutsch</value> + </row> + </table> +</dataset> diff --git a/tests/functions/language_select_test.php b/tests/functions/language_select_test.php new file mode 100644 index 0000000000..3e7ed45bbf --- /dev/null +++ b/tests/functions/language_select_test.php @@ -0,0 +1,38 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_functions_language_select_test extends phpbb_database_test_case +{ + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/language_select.xml'); + } + + static public function language_select_data() + { + return array( + array('', '<option value="en">English</option><option value="de">Deutsch</option>'), + array('en', '<option value="en" selected="selected">English</option><option value="de">Deutsch</option>'), + array('de', '<option value="en">English</option><option value="de" selected="selected">Deutsch</option>'), + ); + } + + /** + * @dataProvider language_select_data + */ + public function test_language_select($default, $expected) + { + global $db; + $db = $this->new_dbal(); + + $this->assertEquals($expected, language_select($default)); + } +} |