diff options
author | Shitiz Garg <mail@dragooon.net> | 2014-06-24 22:12:00 +0530 |
---|---|---|
committer | Shitiz Garg <mail@dragooon.net> | 2014-06-24 22:12:00 +0530 |
commit | 7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c (patch) | |
tree | ba60cb43fa0886c0d49066612572f702a5f44d81 /tests | |
parent | 8cef0b69715e04cb39ab365e4bdb01a958e7126b (diff) | |
download | forums-7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c.tar forums-7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c.tar.gz forums-7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c.tar.bz2 forums-7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c.tar.xz forums-7a5afdeb4c05c55d6759c5ccf49a301cda4aa14c.zip |
[ticket/12334] Add get_profile_value_raw unit tests for type_int
PHPBB3-12334
Diffstat (limited to 'tests')
-rw-r--r-- | tests/profilefields/type_int_test.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php index 611edd32b9..312b3874b8 100644 --- a/tests/profilefields/type_int_test.php +++ b/tests/profilefields/type_int_test.php @@ -169,6 +169,60 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case $this->assertSame($expected, $result, $description); } + public function get_profile_value_raw_data() + { + return array( + array( + '10', + array('field_show_novalue' => true), + 10, + 'Field should return the correct raw value', + ), + array( + '0', + array('field_show_novalue' => true), + 0, + 'Field should return correct raw value', + ), + array( + '', + array('field_show_novalue' => true), + 0, + 'Field should return correct raw value', + ), + array( + '10', + array('field_show_novalue' => false), + 10, + 'Field should return the correct raw value', + ), + array( + '0', + array('field_show_novalue' => false), + 0, + 'Field should return correct raw value', + ), + array( + '', + array('field_show_novalue' => false), + 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 return_callback_implode() { return implode('-', func_get_args()); |