mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/12334] Add get_profile_value_raw unit test for type_bool
PHPBB3-12334
This commit is contained in:
parent
e406cc6fad
commit
24eeab4883
1 changed files with 52 additions and 4 deletions
|
@ -130,6 +130,54 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
|
||||||
$this->assertSame($expected, $result, $description);
|
$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)
|
public function is_set_callback($field_id, $lang_id, $field_value)
|
||||||
{
|
{
|
||||||
return isset($this->options[$field_value]);
|
return isset($this->options[$field_value]);
|
||||||
|
|
Loading…
Add table
Reference in a new issue