<commit_before><?php

class CM_Usertext_Filter_BadwordsTest extends CMTest_TestCase {

	public static function tearDownAfterClass() {
		CMTest_TH::clearEnv();
	}

	public function testProcess() {
		$badwords = new CM_Paging_ContentList_Badwords();
		$badwords->add('foo');

		$filter = new CM_Usertext_Filter_Badwords();
		$actual = $filter->transform('Stop the foo here!');
		$this->assertEquals('Stop the … here!', $actual);
	}

}<commit_msg>updated CM_Usertext_Filter_BadwordsTest<commit_after><?php

class CM_Usertext_Filter_BadwordsTest extends CMTest_TestCase {

	public static function tearDownAfterClass() {
		CMTest_TH::clearEnv();
	}

	public function testProcess() {
		$replace = '…';
		$badwords = new CM_Paging_ContentList_Badwords();
		$badwords->add('foo');
		$badwords->add('f(o-].)o');
		$badwords->add('bar*');
		$badwords->add('*foobar*');
		$badwords->add('*zoo*far*');
		CMTest_TH::clearCache();

		$filter = new CM_Usertext_Filter_Badwords();

		$actual = $filter->transform("hello foo there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello Foo there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello foot there");
		$this->assertEquals("hello foot there", $actual);

		$actual = $filter->transform("hello f(o-].)o there");
		$this->assertEquals("hello ${replace} there", $actual);

		$actual = $filter->transform("hello bar there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello bart there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello bar3 there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello bartender there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello bar.de there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello bar. there");
		$this->assertEquals("hello ${replace}. there", $actual);

		$actual = $filter->transform("hello foobar there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello XfoobarX there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello mayo.foobar.ran there");
		$this->assertEquals("hello ${replace} there", $actual);

		$actual = $filter->transform("hello zoofar there");
		$this->assertEquals("hello ${replace} there", $actual);

		$actual = $filter->transform("hello zoo!!far there");
		$this->assertEquals("hello ${replace} there", $actual);
		$actual = $filter->transform("hello zoo far there");
		$this->assertEquals("hello zoo far there", $actual);
	}

}
{'fraction_non_alphanumeric': 0.19080376538740043, 'fraction_numerical': 0.0003620564808110065, 'mean_word_length': 6.084615384615384, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6339230', 'n_tokens_mistral': 908, 'n_tokens_neox': 837, 'n_words': 188}