aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions/language_select_test.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functions/language_select_test.php')
-rw-r--r--tests/functions/language_select_test.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/functions/language_select_test.php b/tests/functions/language_select_test.php
new file mode 100644
index 0000000000..3ec2bd4bc3
--- /dev/null
+++ b/tests/functions/language_select_test.php
@@ -0,0 +1,39 @@
+<?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>'),
+ array('cs', '<option value="en">English</option><option value="de">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));
+ }
+}