From 25be16748dc39b2e30bd55472d8e5d6ef60f1c39 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 May 2013 15:55:21 +0200 Subject: [PATCH] [ticket/11541] Add unit tests for style_select() PHPBB3-11541 --- tests/functions/fixtures/style_select.xml | 23 +++++++++++++ tests/functions/style_select_test.php | 41 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 tests/functions/fixtures/style_select.xml create mode 100644 tests/functions/style_select_test.php diff --git a/tests/functions/fixtures/style_select.xml b/tests/functions/fixtures/style_select.xml new file mode 100644 index 0000000000..12d6392ab5 --- /dev/null +++ b/tests/functions/fixtures/style_select.xml @@ -0,0 +1,23 @@ + + + + style_id + style_name + style_active + + 1 + prosilver + 1 + + + 2 + subsilver2 + 1 + + + 3 + zoo + 0 + +
+
diff --git a/tests/functions/style_select_test.php b/tests/functions/style_select_test.php new file mode 100644 index 0000000000..1e44f3c2cb --- /dev/null +++ b/tests/functions/style_select_test.php @@ -0,0 +1,41 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/style_select.xml'); + } + + static public function style_select_data() + { + return array( + array('', false, ''), + array('', true, ''), + array('1', false, ''), + array('1', true, ''), + array('3', false, ''), + array('3', true, ''), + ); + } + + /** + * @dataProvider style_select_data + */ + public function test_style_select($default, $all, $expected) + { + global $db; + $db = $this->new_dbal(); + + $this->assertEquals($expected, style_select($default, $all)); + } +}