aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/api/ApiBlockTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/api/ApiBlockTest.php')
-rw-r--r--tests/phpunit/includes/api/ApiBlockTest.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php
index 7f15985a9c6f..3c4334d5fd2e 100644
--- a/tests/phpunit/includes/api/ApiBlockTest.php
+++ b/tests/phpunit/includes/api/ApiBlockTest.php
@@ -348,6 +348,22 @@ class ApiBlockTest extends ApiTestCase {
$this->doBlock();
}
+ public function testNonNormalizedRangeBlock() {
+ $params = [
+ 'action' => 'block',
+ 'user' => '128.0.0.1/16',
+ 'reason' => 'Some reason',
+ ];
+ $res = $this->doApiRequestWithToken( $params );
+ $this->assertSame( '128.0.0.0/16', $res[0]['block']['user'] );
+ $this->newSelectQueryBuilder()
+ ->select( 'bt_address' )
+ ->from( 'block_target' )
+ ->join( 'block', null, 'bl_target=bt_id' )
+ ->where( [ 'bl_id' => $res[0]['block']['id'] ] )
+ ->assertFieldValue( '128.0.0.0/16' );
+ }
+
public function testBlockByIdReturns() {
// See T189073 and Ifdced735b694b85116cb0e43dadbfa8e4cdb8cab for context
$userId = $this->mUser->getId();