diff --git a/tests/mock/cache.php b/tests/mock/cache.php index 11e525ff79..020574b0bb 100644 --- a/tests/mock/cache.php +++ b/tests/mock/cache.php @@ -41,6 +41,28 @@ class phpbb_mock_cache { return $this->data['_bots']; } + + /** + * Obtain list of word censors. We don't need to parse them here, + * that is tested elsewhere. + */ + public function obtain_word_list() + { + return array( + 'match' => array( + '#(? array( + 'replacement1', + 'replacement2', + 'replacement3', + 'replacement4', + ), + ); + } public function set_bots($bots) { diff --git a/tests/mock_user.php b/tests/mock_user.php index 74d31c4c4a..a6ff5f6628 100644 --- a/tests/mock_user.php +++ b/tests/mock_user.php @@ -17,4 +17,16 @@ class phpbb_mock_user { public $host = "testhost"; public $page = array('root_script_path' => '/'); + + public function optionget($item) + { + switch ($item) + { + case 'viewcensors': + return false; + + default: + trigger_error('Option not found, add it to the mock user object.'); + } + } } diff --git a/tests/text_processing/censor_text_test.php b/tests/text_processing/censor_text_test.php new file mode 100644 index 0000000000..3820a1135f --- /dev/null +++ b/tests/text_processing/censor_text_test.php @@ -0,0 +1,73 @@ +assertEquals(censor_text($input), $expected, $label); + } +}