22 protected $blacklist = [
'\b01bags\.com\b',
'sytes\.net' ];
38 [
'https://example.com' ],
41 'revision with spam, with additional non-spam' => [
42 [
'https://foo.com',
'http://01bags.com',
'http://bar.com' ],
46 'revision with spam using full width stop normalization' => [
47 [
'http://01bags.com' ],
51 'revision with domain blacklisted as spam, but subdomain whitelisted' => [
52 [
'http://a5b.sytes.net' ],
61 public function testSpam( $links, $expected ) {
62 $returnValue = $this->spamFilter->filter( $links, Title::newMainPage() );
63 $this->assertEquals( $expected, $returnValue );
76 \MessageCache::singleton()->enable();
77 $this->
insertPage(
'MediaWiki:Spam-blacklist', implode(
"\n", $this->blacklist ) );
78 $this->
insertPage(
'MediaWiki:Spam-whitelist', implode(
"\n", $this->whitelist ) );
82 $reflProp = new \ReflectionProperty( $instance,
'regexes' );
83 $reflProp->setAccessible(
true );
84 $reflProp->setValue( $instance,
false );
88 \MessageCache::singleton()->disable();
static getInstance( $type)
Returns an instance of the given blacklist.
testSpam( $links, $expected)
spamProvider
array $whitelist
Spam whitelist regexes.
array $blacklist
Spam blacklist regexes.
SpamBlacklist $spamFilter