aboutsummaryrefslogtreecommitdiffstats
path: root/tests/functions
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2013-05-17 00:38:09 +0200
committerAndreas Fischer <bantu@phpbb.com>2013-05-17 00:38:09 +0200
commit4a1eaab34176cc811ec43f9b3e9916129947eb34 (patch)
tree0fac1d997dad569df53e0679fd1fea4aa50c84bd /tests/functions
parenta87f9ffea8208b36d481027674c11fad9fccbdd1 (diff)
parentf2fd0031f4ee9b254d2281ae8b9ce36c3ad26143 (diff)
downloadforums-4a1eaab34176cc811ec43f9b3e9916129947eb34.tar
forums-4a1eaab34176cc811ec43f9b3e9916129947eb34.tar.gz
forums-4a1eaab34176cc811ec43f9b3e9916129947eb34.tar.bz2
forums-4a1eaab34176cc811ec43f9b3e9916129947eb34.tar.xz
forums-4a1eaab34176cc811ec43f9b3e9916129947eb34.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/11542] Add non-existing default value for language select [ticket/11542] Add lang_english_name to fixture [ticket/11542] Add unit tests for language_select()
Diffstat (limited to 'tests/functions')
-rw-r--r--tests/functions/fixtures/language_select.xml21
-rw-r--r--tests/functions/language_select_test.php39
2 files changed, 60 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..921f2c0a3a
--- /dev/null
+++ b/tests/functions/fixtures/language_select.xml
@@ -0,0 +1,21 @@
+<?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>
+ <column>lang_english_name</column>
+ <row>
+ <value>1</value>
+ <value>en</value>
+ <value>English</value>
+ <value>English</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>de</value>
+ <value>Deutsch</value>
+ <value>German</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..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));
+ }
+}