diff options
author | Marc Alexander <admin@m-a-styles.de> | 2013-10-24 13:55:23 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2013-10-24 13:55:23 +0200 |
commit | 9d4d212e0f71789e1f0332046dd852d80ab9c8ba (patch) | |
tree | e3de96df60d80c913414cc7ac54952de7a78c955 /tests/avatar | |
parent | Merge remote-tracking branch 'cyberalien/ticket/fixes-only/11872' into develop (diff) | |
download | phpbb-9d4d212e0f71789e1f0332046dd852d80ab9c8ba.tar.gz phpbb-9d4d212e0f71789e1f0332046dd852d80ab9c8ba.tar.bz2 phpbb-9d4d212e0f71789e1f0332046dd852d80ab9c8ba.zip |
[ticket/11525] Only remove group or user prefix from given avatar data
Until now, the user data had both user_id and group_id keys in the avatar
data. As both group_ and user_ prefixes were removed the group_id was
collapsed onto the user_id and therefore all users in the same group had
the same prefix for their uploaded avatars. This patch will make sure
that the correct id is used depending on whether it's a group's or user's
avatar data.
PHPBB3-11525
Diffstat (limited to 'tests/avatar')
-rw-r--r-- | tests/avatar/manager_test.php | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 4afa594beb..f687f7bc86 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -201,20 +201,58 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase 'foobar_avatar_height' => '', ), ), + array( + array( + 'user_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 4, + ), + ), + array( + array( + 'user_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 5, + 'group_id' => 4, + ), + 'user', + ), + array( + array( + 'group_avatar' => '', + 'user_id' => 5, + 'group_id' => 4, + ), + array( + 'avatar' => '', + 'id' => 4, + 'user_id' => 5, + ), + 'group', + ), ); } /** * @dataProvider database_row_data */ - public function test_clean_row(array $input, array $output) + public function test_clean_row(array $input, array $output, $prefix = '') { $cleaned_row = array(); - $cleaned_row = \phpbb\avatar\manager::clean_row($input); - foreach ($output as $key => $null) + $cleaned_row = \phpbb\avatar\manager::clean_row($input, $prefix); + foreach ($output as $key => $value) { $this->assertArrayHasKey($key, $cleaned_row); + $this->assertEquals($output[$key], $value); } } |