From 6900e8dae08b4a8c1af3529a418f5156b0cfd157 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 May 2013 15:55:05 +0200 Subject: [ticket/11542] Add unit tests for language_select() PHPBB3-11542 --- tests/functions/fixtures/language_select.xml | 18 +++++++++++++ tests/functions/language_select_test.php | 38 ++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 tests/functions/fixtures/language_select.xml create mode 100644 tests/functions/language_select_test.php (limited to 'tests/functions') 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 @@ + + + + lang_id + lang_iso + lang_local_name + + 1 + en + English + + + 2 + de + Deutsch + +
+
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 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/language_select.xml'); + } + + static public function language_select_data() + { + return array( + array('', ''), + array('en', ''), + array('de', ''), + ); + } + + /** + * @dataProvider language_select_data + */ + public function test_language_select($default, $expected) + { + global $db; + $db = $this->new_dbal(); + + $this->assertEquals($expected, language_select($default)); + } +} -- cgit v1.2.1 From 14ab0ba594c1b78176452c012965fa4ec723f37f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 15 May 2013 15:18:28 +0200 Subject: [ticket/11542] Add lang_english_name to fixture PHPBB3-11542 --- tests/functions/fixtures/language_select.xml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/functions') diff --git a/tests/functions/fixtures/language_select.xml b/tests/functions/fixtures/language_select.xml index 02fdee093e..921f2c0a3a 100644 --- a/tests/functions/fixtures/language_select.xml +++ b/tests/functions/fixtures/language_select.xml @@ -4,15 +4,18 @@ lang_id lang_iso lang_local_name + lang_english_name 1 en English + English 2 de Deutsch + German -- cgit v1.2.1 From 92e1e86e5c75879c2b538cbf738de947eadb08d3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 16 May 2013 00:14:40 +0200 Subject: [ticket/11542] Add non-existing default value for language select PHPBB3-11542 --- tests/functions/language_select_test.php | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/functions') diff --git a/tests/functions/language_select_test.php b/tests/functions/language_select_test.php index 3e7ed45bbf..3ec2bd4bc3 100644 --- a/tests/functions/language_select_test.php +++ b/tests/functions/language_select_test.php @@ -22,6 +22,7 @@ class phpbb_functions_language_select_test extends phpbb_database_test_case array('', ''), array('en', ''), array('de', ''), + array('cs', ''), ); } -- cgit v1.2.1