[ticket/10714] Add docblock for the test cases

PHPBB3-10714
This commit is contained in:
Joas Schilling 2012-03-24 17:02:56 +01:00
parent 325827c40f
commit 1e00c697b7
2 changed files with 54 additions and 25 deletions

View file

@ -19,6 +19,35 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
public static function test_add_log_function_data()
{
return array(
/**
* Case documentation
array(
// Row that is in the database afterwards
array(
'user_id' => ANONYMOUS,
'log_type' => LOG_MOD,
'log_operation' => 'LOG_MOD_ADDITIONAL',
// log_data will be serialized
'log_data' => array(
'argument3',
),
'reportee_id' => 0,
'forum_id' => 56,
'topic_id' => 78,
),
// user_id Can also be false, than ANONYMOUS is used
false,
// log_mode Used to determinate the log_type
'mod',
// Followed by some additional arguments
// forum_id, topic_id and reportee_id are specified before log_operation
// The rest is specified afterwards.
56,
78,
'LOG_MOD_ADDITIONAL', // log_operation
'argument3',
),
*/
array(
array(
'user_id' => 2,

View file

@ -210,77 +210,77 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
);
$test_cases = array(
/**
* Case documentation
array(
// Array of datasets that should be in $log after running the function
'expected' => array(5, 7),
// Offset that will be returned form the function
'expected_returned' => 0,
// view_log parameters (see includes/functions_admin.php for docblock)
// $log is ommited!
'mod', 5, 0, 12, 45,
),
*/
array(
'expected' => array(1, 2),
'expected_returned' => 0,
false,
'admin',
'admin', false,
),
array(
'expected' => array(1),
'expected_returned' => 0,
false,
'admin', 1,
'admin', false, 1,
),
array(
'expected' => array(2),
'expected_returned' => 1,
false,
'admin', 1, 1,
'admin', false, 1, 1,
),
array(
'expected' => array(2),
'expected_returned' => 1,
0,
'admin', 1, 1,
'admin', 0, 1, 1,
),
array(
'expected' => array(2),
'expected_returned' => 1,
0,
'admin', 1, 5,
'admin', 0, 1, 5,
),
array(
'expected' => array(3),
'expected_returned' => 0,
false,
'critical',
'critical', false,
),
array(
'expected' => array(),
'expected_returned' => null,
false,
'mode_does_not_exist',
'mode_does_not_exist', false,
),
array(
'expected' => array(4, 5, 7),
'expected_returned' => 0,
0,
'mod', 5, 0, 12,
'mod', 0, 5, 0, 12,
),
array(
'expected' => array(5, 7),
'expected_returned' => 0,
0,
'mod', 5, 0, 12, 45,
'mod', 0, 5, 0, 12, 45,
),
array(
'expected' => array(6),
'expected_returned' => 0,
0,
'mod', 5, 0, 23,
'mod', 0, 5, 0, 23,
),
array(
'expected' => array(8),
'expected_returned' => 0,
0,
'user', 5, 0, 0, 0, 2,
'user', 0, 5, 0, 0, 0, 2,
),
array(
'expected' => array(8, 9),
'expected_returned' => 0,
0,
'users',
'users', 0,
),
);
@ -298,7 +298,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
/**
* @dataProvider test_view_log_function_data
*/
public function test_view_log_function($expected, $expected_returned, $log_count, $mode, $limit = 5, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_id ASC', $keywords = '')
public function test_view_log_function($expected, $expected_returned, $mode, $log_count, $limit = 5, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_id ASC', $keywords = '')
{
global $cache, $db, $user, $auth;