Merge "docs: Fix typo"
[mediawiki.git] / tests / phpunit / includes / block / AutoblockExemptionListTest.php
blob744c425b7f8caf4672386e47c09db37da29ed81d
1 <?php
3 namespace MediaWiki\Tests\Block;
5 use MediaWiki\Title\Title;
6 use MediaWikiIntegrationTestCase;
8 /**
9 * @group Database
10 * @group Blocking
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 ) {
22 $this->assertSame(
23 $expectedReturnValue,
24 $this->getServiceContainer()->getAutoblockExemptionList()->isExempt( $ip )
28 public static function provideIsExempt() {
29 return [
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() {
37 $this->editPage(
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"