aboutsummaryrefslogtreecommitdiffstats
path: root/tests/text_processing
diff options
context:
space:
mode:
authorMáté Bartus <CHItA@users.noreply.github.com>2017-09-07 15:09:48 +0200
committerGitHub <noreply@github.com>2017-09-07 15:09:48 +0200
commit114f38648b837530e2656d3c67941c003ae9f91b (patch)
tree6ed0ccc78b40c1175af407b34900c306550d9798 /tests/text_processing
parentf6166225cfea68e5b7f8dd1e6ef7df8e4fd1e8b3 (diff)
parentde6a0a7dc1e0e52f05e7b5ced085ef8f17650ff1 (diff)
downloadforums-114f38648b837530e2656d3c67941c003ae9f91b.tar
forums-114f38648b837530e2656d3c67941c003ae9f91b.tar.gz
forums-114f38648b837530e2656d3c67941c003ae9f91b.tar.bz2
forums-114f38648b837530e2656d3c67941c003ae9f91b.tar.xz
forums-114f38648b837530e2656d3c67941c003ae9f91b.zip
Merge pull request #4900 from rxu/ticket/15318
[ticket/15318] Make user option to disable word censoring effective again
Diffstat (limited to 'tests/text_processing')
-rw-r--r--tests/text_processing/generate_text_for_display_test.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/text_processing/generate_text_for_display_test.php b/tests/text_processing/generate_text_for_display_test.php
index 9c7152a008..86bc803c98 100644
--- a/tests/text_processing/generate_text_for_display_test.php
+++ b/tests/text_processing/generate_text_for_display_test.php
@@ -29,7 +29,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
*/
public function test_legacy($original, $expected, $uid = '', $bitfield = '', $flags = 0, $censor_text = true)
{
- global $cache, $user;
+ global $auth, $cache, $config, $user;
global $phpbb_root_path, $phpEx;
@@ -63,7 +63,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
public function test_censor_is_restored()
{
- global $phpbb_container;
+ global $auth, $user, $config, $phpbb_container;
$phpbb_container = new phpbb_mock_container_builder;
@@ -72,7 +72,8 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$lang_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx);
$lang = new \phpbb\language\language($lang_loader);
$user = new \phpbb\user($lang, '\phpbb\datetime');
- $user->optionset('viewcensors', false);
+ // Do not ignore word censoring by user (switch censoring on in UCP)
+ $user->optionset('viewcensors', true);
$config = new \phpbb\config\config(array('allow_nocensors' => true));
@@ -102,6 +103,14 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
$this->assertSame('apple', $renderer->render($original));
$this->assertSame('banana', generate_text_for_display($original, '', '', 0, true));
$this->assertSame('apple', $renderer->render($original), 'The original setting was not restored');
+
+ // Test user option switch to ignore censoring
+ $renderer->set_viewcensors(true);
+ // 1st: censoring is still on in UCP
+ $this->assertSame('banana', generate_text_for_display($original, '', '', 0, true));
+ // 2nd: switch censoring off in UCP
+ $user->optionset('viewcensors', false);
+ $this->assertSame('apple', generate_text_for_display($original, '', '', 0, true));
}
/**
@@ -109,7 +118,7 @@ class phpbb_text_processing_generate_text_for_display_test extends phpbb_test_ca
*/
public function test_text_formatter($original, $expected, $censor_text = true, $setup = null)
{
- global $phpbb_container;
+ global $auth, $user, $config, $phpbb_container;
$phpbb_container = new phpbb_mock_container_builder;