3 namespace MediaWiki\Tests\Block
;
5 use MediaWiki\Title\Title
;
6 use MediaWikiIntegrationTestCase
;
11 * @covers \MediaWiki\Block\AutoblockExemptionList
13 class AutoblockExemptionListTest
extends MediaWikiIntegrationTestCase
{
15 protected function setUp(): void
{
16 // Allow the MediaWiki override to take effect
17 $this->getServiceContainer()->getMessageCache()->enable();
20 /** @dataProvider provideIsExempt */
21 public function testIsExempt( $ip, $expectedReturnValue ) {
24 $this->getServiceContainer()->getAutoblockExemptionList()->isExempt( $ip )
28 public static function provideIsExempt() {
30 'IP is exempt from autoblocks' => [ '1.2.3.4', true ],
31 'IP is not exempt from autoblocks' => [ '1.2.3.5', false ],
32 'IP is exempt from autoblocks based on IP range exemption' => [ '7.8.9.40', true ],
36 public function addDBDataOnce() {
38 Title
::newFromText( 'block-autoblock-exemptionlist', NS_MEDIAWIKI
),
39 '[[Test]]. This is a autoblocking exemption list description.' .
40 "\n\n* 1.2.3.4\n** 1.2.3.6\n* 7.8.9.0/24"