diff options
author | Shitiz Garg <mail@dragooon.net> | 2014-06-24 22:34:59 +0530 |
---|---|---|
committer | Shitiz Garg <mail@dragooon.net> | 2014-06-24 22:46:43 +0530 |
commit | 24eeab4883c9ced8ba12d99a7cbc14839ba19388 (patch) | |
tree | 0580f931f4793031fa0ac58dde4359b0ccbe17dd /tests/profilefields/type_bool_test.php | |
parent | e406cc6fadfc753369c1118c49bddca6523ee2db (diff) | |
download | forums-24eeab4883c9ced8ba12d99a7cbc14839ba19388.tar forums-24eeab4883c9ced8ba12d99a7cbc14839ba19388.tar.gz forums-24eeab4883c9ced8ba12d99a7cbc14839ba19388.tar.bz2 forums-24eeab4883c9ced8ba12d99a7cbc14839ba19388.tar.xz forums-24eeab4883c9ced8ba12d99a7cbc14839ba19388.zip |
[ticket/12334] Add get_profile_value_raw unit test for type_bool
PHPBB3-12334
Diffstat (limited to 'tests/profilefields/type_bool_test.php')
-rw-r--r-- | tests/profilefields/type_bool_test.php | 56 |
1 files changed, 52 insertions, 4 deletions
diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php index 29c118d57d..ad9dd6514c 100644 --- a/tests/profilefields/type_bool_test.php +++ b/tests/profilefields/type_bool_test.php @@ -74,10 +74,10 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case { return array( array( - false, - array('field_required' => true), - 'FIELD_REQUIRED-field', - 'Field should not accept empty values for required fields', + false, + array('field_required' => true), + 'FIELD_REQUIRED-field', + 'Field should not accept empty values for required fields', ), ); } @@ -130,6 +130,54 @@ class phpbb_profilefield_type_bool_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), + null, + '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), + null, + '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->options[$field_value]); |