From fb1984dadb2ef4ec679f3a66e1a98e75bbe38dec Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 11 Mar 2013 10:33:16 +0100 Subject: [ticket/11404] Add tests for phpbb_avatar_manager::clean_row() PHPBB3-11404 --- tests/avatar/manager_test.php | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'tests/avatar/manager_test.php') diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php index 7ea3cc6a0f..ffcfe2ce11 100644 --- a/tests/avatar/manager_test.php +++ b/tests/avatar/manager_test.php @@ -87,4 +87,75 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase $this->assertEquals($expected_settings, $avatar_settings); } + + public function database_row_data() + { + return array( + array( + array( + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => '', + 'user_avatar_height' => '', + ), + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => '', + 'avatar_height' => '', + ), + ), + array( + array( + 'group_avatar' => '', + 'group_avatar_type' => '', + 'group_avatar_width' => '', + 'group_avatar_height' => '', + ), + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => '', + 'avatar_height' => '', + ), + ), + array( + array(), + array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => '', + 'avatar_height' => '', + ), + ), + array( + array( + 'foobar_avatar' => '', + 'foobar_avatar_type' => '', + 'foobar_avatar_width' => '', + 'foobar_avatar_height' => '', + ), + array( + 'foobar_avatar' => '', + 'foobar_avatar_type' => '', + 'foobar_avatar_width' => '', + 'foobar_avatar_height' => '', + ), + ), + ); + } + + /** + * @dataProvider database_row_data + */ + public function test_clean_row(array $input, array $output) + { + $cleaned_row = array(); + + $cleaned_row = phpbb_avatar_manager::clean_row($input); + foreach ($output as $key => $null) + { + $this->assertArrayHasKey($key, $cleaned_row); + } + } } -- cgit v1.2.1