Merge remote-tracking branch 'remotes/Nicofuma/ticket/12444' into develop-ascraeus

# By Nicofuma
# Via Nicofuma
* remotes/Nicofuma/ticket/12444:
  [ticket/12444] Replacing spaces with tabs
  [ticket/12444] Replace spaces with tabs
  [ticket/12444] Adding regression test
  [ticket/12444] The logs message aren't filled correctly
This commit is contained in:
Nathaniel Guse 2014-05-01 21:49:18 -05:00
commit 4f236729e4
3 changed files with 40 additions and 1 deletions

View file

@ -520,7 +520,7 @@ class log implements \phpbb\log\log_interface
$num_args = 0; $num_args = 0;
if (!is_array($this->user->lang[$row['log_operation']])) if (!is_array($this->user->lang[$row['log_operation']]))
{ {
$num_args = substr_count($log[$i]['action'], '%'); $num_args = substr_count($this->user->lang[$row['log_operation']], '%');
} }
else else
{ {

View file

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

View file

@ -225,6 +225,27 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'viewforum' => '', 'viewforum' => '',
'action' => 'LOG_SINGULAR_PLURAL 2', 'action' => 'LOG_SINGULAR_PLURAL 2',
), ),
11 => array(
'id' => 11,
'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' => 15,
'topic_id' => 3,
'viewforum' => '',
'action' => 'LOG_MOD3 guest ',
'viewtopic' => '',
'viewlogs' => '',
),
); );
$test_cases = array( $test_cases = array(
@ -310,6 +331,11 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'expected_returned' => 0, 'expected_returned' => 0,
'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural', 'user', false, 5, 0, 0, 0, 0, 0, 'l.log_id ASC', 'plural',
), ),
array(
'expected' => array(11),
'expected_returned' => 0,
'mod', 0, 5, 0, 15, 3,
),
); );
foreach ($test_cases as $case => $case_data) foreach ($test_cases as $case => $case_data)
@ -362,6 +388,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'LOG_INSTALL_INSTALLED' => 'installed: %s', 'LOG_INSTALL_INSTALLED' => 'installed: %s',
'LOG_USER' => 'User<br /> %s', 'LOG_USER' => 'User<br /> %s',
'LOG_MOD2' => 'Mod2', 'LOG_MOD2' => 'Mod2',
'LOG_MOD3' => 'Mod3: %1$s, %2$s',
'LOG_SINGULAR_PLURAL' => array( 'LOG_SINGULAR_PLURAL' => array(
1 => 'singular', 1 => 'singular',
2 => 'plural (%d)', 2 => 'plural (%d)',