aboutsummaryrefslogtreecommitdiffstats
path: root/tests/profilefields
diff options
context:
space:
mode:
authorShitiz Garg <mail@dragooon.net>2014-06-24 22:27:30 +0530
committerShitiz Garg <mail@dragooon.net>2014-06-24 22:46:43 +0530
commit15929201b8cadc64f4a0fbcb49ddf5b6426f79a6 (patch)
tree944acfaf5a9187e38be98bbb140400b067671726 /tests/profilefields
parentab6d36dd576aadf37a36da2cd2f4ba1219540253 (diff)
downloadforums-15929201b8cadc64f4a0fbcb49ddf5b6426f79a6.tar
forums-15929201b8cadc64f4a0fbcb49ddf5b6426f79a6.tar.gz
forums-15929201b8cadc64f4a0fbcb49ddf5b6426f79a6.tar.bz2
forums-15929201b8cadc64f4a0fbcb49ddf5b6426f79a6.tar.xz
forums-15929201b8cadc64f4a0fbcb49ddf5b6426f79a6.zip
[ticket/12334] Add get_profile_value_raw unit tests for type_dropdown
PHPBB3-12334
Diffstat (limited to 'tests/profilefields')
-rw-r--r--tests/profilefields/type_dropdown_test.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index 0e92afd504..ae5402177a 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -170,6 +170,54 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
$this->assertSame($expected, $result, $description);
}
+ public function get_profile_value_raw_data()
+ {
+ return array(
+ array(
+ '4',
+ array('field_show_novalue' => true),
+ '4',
+ 'Field should return the correct raw value',
+ ),
+ array(
+ '',
+ array('field_show_novalue' => false),
+ null,
+ 'Field should return correct raw value',
+ ),
+ array(
+ '',
+ array('field_show_novalue' => true),
+ 0,
+ 'Field should return correct raw value',
+ ),
+ array(
+ null,
+ array('field_show_novalue' => false),
+ null,
+ 'Field should return correct raw value',
+ ),
+ array(
+ null,
+ array('field_show_novalue' => true),
+ 0,
+ 'Field should return correct raw value',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider get_profile_value_raw_data
+ */
+ public function test_get_profile_value_raw($value, $field_options, $expected, $description)
+ {
+ $field_options = array_merge($this->field_options, $field_options);
+
+ $result = $this->cp->get_profile_value_raw($value, $field_options);
+
+ $this->assertSame($expected, $result, $description);
+ }
+
public function is_set_callback($field_id, $lang_id, $field_value)
{
return isset($this->dropdown_options[$field_value]);