From 2a822931c6d95fe9e6066752ec59ab614189837e Mon Sep 17 00:00:00 2001 From: Cesar G Date: Wed, 19 Mar 2014 03:05:36 -0700 Subject: [ticket/11959] Add unit tests. PHPBB3-11959 --- tests/functions/generate_string_list.php | 60 ++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/functions/generate_string_list.php (limited to 'tests/functions/generate_string_list.php') diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php new file mode 100644 index 0000000000..60269b5656 --- /dev/null +++ b/tests/functions/generate_string_list.php @@ -0,0 +1,60 @@ +user = new \phpbb\user(); + $this->user->data = array('user_lang' => 'en'); + $this->user->add_lang('common'); + } + + public function generate_string_list_data() + { + return array( + array( + array(), + '', + ), + array( + array('A'), + 'A', + ), + array( + array(2 => 'A', 3 => 'B'), + 'A and B', + ), + array( + array('A' => 'A', 'B' => 'B', 'C' => 'C'), + 'A, B, and C', + ), + array( + array('A', 'B', 'C', 'D'), + 'A, B, C, and D', + ) + ); + } + + /** + * @dataProvider generate_string_list_data + */ + public function test_generate_string_list($items, $expected_result) + { + $result = phpbb_generate_string_list($items, $this->user); + $this->assertEquals($expected_result, $result); + } +} -- cgit v1.2.1