[ticket/12422] Add tests

PHPBB3-12422
This commit is contained in:
Oliver Schramm 2014-04-22 02:44:34 +02:00
parent 1905a2a7b2
commit bf3425b0f8
2 changed files with 46 additions and 1 deletions

View file

@ -119,6 +119,18 @@
<value>LOG_USER</value>
<value>a:1:{i:0;s:5:"guest";}</value>
</row>
<row>
<value>10</value>
<value>3</value>
<value>1</value>
<value>0</value>
<value>0</value>
<value>0</value>
<value>127.0.0.1</value>
<value>1</value>
<value>LOG_SINGULAR_PLURAL</value>
<value>a:1:{i:0;i:2;}</value>
</row>
</table>
<table name="phpbb_users">
<column>user_id</column>

View file

@ -206,6 +206,25 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'viewforum' => '',
'action' => 'LOG_USER guest',
),
10 => array(
'id' => 10,
'reportee_id' => 0,
'reportee_username' => '',
'reportee_username_full'=> '',
'user_id' => 1,
'username' => 'Anonymous',
'username_full' => 'Anonymous',
'ip' => '127.0.0.1',
'time' => 1,
'forum_id' => 0,
'topic_id' => 0,
'viewforum' => '',
'action' => 'LOG_SINGULAR_PLURAL 2',
),
);
$test_cases = array(
@ -277,10 +296,20 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'user', 0, 5, 0, 0, 0, 2,
),
array(
'expected' => array(8, 9),
'expected' => array(8, 9, 10),
'expected_returned' => 0,
'users', 0,
),
array(
'expected' => array(1),
'expected_returned' => 0,
'admin', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'install',
),
array(
'expected' => array(10),
'expected_returned' => 0,
'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural',
),
);
foreach ($test_cases as $case => $case_data)
@ -333,6 +362,10 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'LOG_INSTALL_INSTALLED' => 'installed: %s',
'LOG_USER' => 'User<br /> %s',
'LOG_MOD2' => 'Mod2',
'LOG_SINGULAR_PLURAL' => array(
1 => 'singular',
2 => 'plural (%d)',
),
);
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);