mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 19:54:12 +02:00
Merge branch 'develop-ascraeus' into develop
* develop-ascraeus: [ticket/12334] Remove profile fields test group [ticket/12334] Add additional test for type_string [ticket/12334] Add string test for type_int [ticket/12334] Improve type_dropdown's test description [ticket/12334] Group profile fields test [ticket/12334] Change get_profile_value_raw_data to profile_value_raw_data [ticket/12334] Add get_profile_value_raw unit test for type_bool [ticket/12334] Add get_profile_value_raw unit test for type_date [ticket/12334] Add get_profile_value_raw unit tests for type_dropdown [ticket/12334] Add get_profile_value_raw unit test for type_string [ticket/12334] Add get_profile_value_raw unit test for type_url [ticket/12334] Add get_profile_value_raw unit tests for type_int [ticket/12334] Removed tests [ticket/12334] Dropdowns cannot be tested this way [ticket/12334] Added test get_profile_value_raw [ticket/12334] Changed from valueid to value_raw [ticket/12334] Implemented get_profile_valueid method [ticket/12334] Added field_novalue fall-back as requested [ticket/12334] Add PROFILE_FIELD_VALUEID template var
This commit is contained in:
@@ -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 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 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]);
|
||||
|
@@ -179,6 +179,42 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
|
||||
$this->assertSame($expected, $result, $description);
|
||||
}
|
||||
|
||||
public function profile_value_raw_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'',
|
||||
array('field_show_novalue' => false),
|
||||
null,
|
||||
'Field should return the correct raw value',
|
||||
),
|
||||
array(
|
||||
'',
|
||||
array('field_show_novalue' => true),
|
||||
'',
|
||||
'Field should return correct raw value',
|
||||
),
|
||||
array(
|
||||
'12/06/2014',
|
||||
array('field_show_novalue' => true),
|
||||
'12/06/2014',
|
||||
'Field should return correct raw value',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider 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());
|
||||
|
@@ -170,6 +170,54 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
|
||||
$this->assertSame($expected, $result, $description);
|
||||
}
|
||||
|
||||
public function 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 null for empty value without show_novalue',
|
||||
),
|
||||
array(
|
||||
'',
|
||||
array('field_show_novalue' => true),
|
||||
0,
|
||||
'Field should return 0 for empty value with show_novalue',
|
||||
),
|
||||
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 0 for empty value with show_novalue',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider 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]);
|
||||
|
@@ -169,6 +169,66 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
|
||||
$this->assertSame($expected, $result, $description);
|
||||
}
|
||||
|
||||
public function 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',
|
||||
),
|
||||
array(
|
||||
'string',
|
||||
array('field_show_novalue' => false),
|
||||
0,
|
||||
'Field should return int cast of passed string'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider 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());
|
||||
|
@@ -225,6 +225,60 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
|
||||
$this->assertSame($expected, $result, $description);
|
||||
}
|
||||
|
||||
public function profile_value_raw_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'[b]bbcode test[/b]',
|
||||
array('field_show_novalue' => true),
|
||||
'[b]bbcode test[/b]',
|
||||
'Field should return the correct raw value',
|
||||
),
|
||||
array(
|
||||
'[b]bbcode test[/b]',
|
||||
array('field_show_novalue' => false),
|
||||
'[b]bbcode test[/b]',
|
||||
'Field should return correct raw value',
|
||||
),
|
||||
array(
|
||||
125,
|
||||
array('field_show_novalue' => false),
|
||||
125,
|
||||
'Field should return value of integer as is',
|
||||
),
|
||||
array(
|
||||
0,
|
||||
array('field_show_novalue' => false),
|
||||
null,
|
||||
'Field should return null for empty integer without show_novalue',
|
||||
),
|
||||
array(
|
||||
0,
|
||||
array('field_show_novalue' => true),
|
||||
0,
|
||||
'Field should return 0 for empty integer with show_novalue',
|
||||
),
|
||||
array(
|
||||
null,
|
||||
array('field_show_novalue' => true),
|
||||
null,
|
||||
'field should return null value as is',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider 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());
|
||||
|
@@ -104,6 +104,36 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
|
||||
$this->assertSame($expected, $result, $description);
|
||||
}
|
||||
|
||||
public function profile_value_raw_data()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'http://example.com',
|
||||
array('field_show_novalue' => true),
|
||||
'http://example.com',
|
||||
'Field should return the correct raw value',
|
||||
),
|
||||
array(
|
||||
'http://example.com',
|
||||
array('field_show_novalue' => false),
|
||||
'http://example.com',
|
||||
'Field should return correct raw value',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider 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());
|
||||
|
Reference in New Issue
Block a user