diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/functions_content/phpbb_clean_search_string_test.php | 38 | ||||
-rw-r--r-- | tests/log/function_view_log_test.php | 8 |
2 files changed, 43 insertions, 3 deletions
diff --git a/tests/functions_content/phpbb_clean_search_string_test.php b/tests/functions_content/phpbb_clean_search_string_test.php new file mode 100644 index 0000000000..de642c9040 --- /dev/null +++ b/tests/functions_content/phpbb_clean_search_string_test.php @@ -0,0 +1,38 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; + +class phpbb_functions_content_phpbb_clean_search_string_test extends phpbb_test_case +{ + public function phpbb_clean_search_string_data() + { + return array( + array('*', ''), + array('* *', ''), + array('test', 'test'), + array(' test ', 'test'), + array(' test * ', 'test'), + array('test* *', 'test*'), + array('* *test*', '*test*'), + array('test test * test', 'test test test'), + array(' some wild*cards * between wo*rds ', 'some wild*cards between wo*rds'), + array(' we * now have*** multiple wild***cards * ', 'we now have* multiple wild*cards'), + array('pi is *** . * **** * *****', 'pi is .'), + ); + } + + /** + * @dataProvider phpbb_clean_search_string_data + */ + public function test_phpbb_clean_search_string($search_string, $expected) + { + $this->assertEquals($expected, phpbb_clean_search_string($search_string)); + } +} diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php index 9148d23bb4..2ddf7522f4 100644 --- a/tests/log/function_view_log_test.php +++ b/tests/log/function_view_log_test.php @@ -164,7 +164,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'topic_id' => 45, 'viewforum' => '', - 'action' => '{LOG MOD2}', + 'action' => 'LOG_MOD2', 'viewtopic' => '', 'viewlogs' => '', ), @@ -185,7 +185,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'topic_id' => 0, 'viewforum' => '', - 'action' => '{LOG USER}<br />admin', + 'action' => 'LOG_USER admin', ), 9 => array( 'id' => 9, @@ -204,7 +204,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case 'topic_id' => 0, 'viewforum' => '', - 'action' => '{LOG USER}<br />guest', + 'action' => 'LOG_USER guest', ), ); @@ -331,6 +331,8 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case // Test sprintf() of the data into the action $user->lang = array( 'LOG_INSTALL_INSTALLED' => 'installed: %s', + 'LOG_USER' => 'User<br /> %s', + 'LOG_MOD2' => 'Mod2', ); $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); |