/* variable used to save up the blockID we insert in this test suite */
private $blockId;
- protected function setUp() {
- parent::setUp();
- $this->setMwGlobals( array(
- 'wgLanguageCode' => 'en',
- 'wgContLang' => Language::factory( 'en' )
- ) );
- }
-
function addDBData() {
-
$user = User::newFromName( 'UTBlockee' );
- if ( $user->getID() == 0 ) {
+ if ( $user->getId() == 0 ) {
$user->addToDatabase();
TestUser::setPasswordForUser( $user, 'UTBlockeePassword' );
$oldBlock->delete();
}
- $blockOptions = array(
+ $blockOptions = [
'address' => 'UTBlockee',
- 'user' => $user->getID(),
+ 'user' => $user->getId(),
'reason' => 'Parce que',
'expiry' => time() + 100500,
- );
+ ];
$this->block = new Block( $blockOptions );
$this->madeAt = wfTimestamp( TS_MW );
}
public static function provideBug29116Data() {
- return array(
- array( null ),
- array( '' ),
- array( false )
- );
+ return [
+ [ null ],
+ [ '' ],
+ [ false ]
+ ];
}
/**
);
// Foreign perspective (blockee not on current wiki)...
- $blockOptions = array(
+ $blockOptions = [
'address' => $username,
'user' => $userId,
'reason' => 'crosswiki block...',
'hideName' => true,
'blockEmail' => true,
'byText' => 'MetaWikiUser',
- );
+ ];
$block = new Block( $blockOptions );
$block->insert();
$this->assertNotEquals( 0, $userId, 'sanity' );
// Foreign perspective (blockee not on current wiki)...
- $blockOptions = array(
+ $blockOptions = [
'address' => 'UserOnForeignWiki',
'user' => $user->getId(),
'reason' => 'crosswiki block...',
'hideName' => true,
'blockEmail' => true,
'byText' => 'MetaWikiUser',
- );
+ ];
$block = new Block( $blockOptions );
$res = $block->insert( $this->db );
$inited = true;
- $blockList = array(
- array( 'target' => '70.2.0.0/16',
+ $blockList = [
+ [ 'target' => '70.2.0.0/16',
'type' => Block::TYPE_RANGE,
'desc' => 'Range Hardblock',
'ACDisable' => false,
'isHardblock' => true,
'isAutoBlocking' => false,
- ),
- array( 'target' => '2001:4860:4001::/48',
+ ],
+ [ 'target' => '2001:4860:4001::/48',
'type' => Block::TYPE_RANGE,
'desc' => 'Range6 Hardblock',
'ACDisable' => false,
'isHardblock' => true,
'isAutoBlocking' => false,
- ),
- array( 'target' => '60.2.0.0/16',
+ ],
+ [ 'target' => '60.2.0.0/16',
'type' => Block::TYPE_RANGE,
'desc' => 'Range Softblock with AC Disabled',
'ACDisable' => true,
'isHardblock' => false,
'isAutoBlocking' => false,
- ),
- array( 'target' => '50.2.0.0/16',
+ ],
+ [ 'target' => '50.2.0.0/16',
'type' => Block::TYPE_RANGE,
'desc' => 'Range Softblock',
'ACDisable' => false,
'isHardblock' => false,
'isAutoBlocking' => false,
- ),
- array( 'target' => '50.1.1.1',
+ ],
+ [ 'target' => '50.1.1.1',
'type' => Block::TYPE_IP,
'desc' => 'Exact Softblock',
'ACDisable' => false,
'isHardblock' => false,
'isAutoBlocking' => false,
- ),
- );
+ ],
+ ];
foreach ( $blockList as $insBlock ) {
$target = $insBlock['target'];
}
public static function providerXff() {
- return array(
- array( 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
+ return [
+ [ 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Range Hardblock'
- ),
- array( 'xff' => '1.2.3.4, 50.2.1.1, 60.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 50.2.1.1, 60.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Range Softblock with AC Disabled'
- ),
- array( 'xff' => '1.2.3.4, 70.2.1.1, 50.1.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 70.2.1.1, 50.1.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Exact Softblock'
- ),
- array( 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 50.1.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 50.1.1.1, 2.3.4.5',
'count' => 3,
'result' => 'Exact Softblock'
- ),
- array( 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 70.2.1.1, 50.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Range Hardblock'
- ),
- array( 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 70.2.1.1, 60.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Range Hardblock'
- ),
- array( 'xff' => '50.2.1.1, 60.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '50.2.1.1, 60.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Range Softblock with AC Disabled'
- ),
- array( 'xff' => '1.2.3.4, 50.1.1.1, 60.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 50.1.1.1, 60.2.1.1, 2.3.4.5',
'count' => 2,
'result' => 'Exact Softblock'
- ),
- array( 'xff' => '1.2.3.4, <$A_BUNCH-OF{INVALID}TEXT\>, 60.2.1.1, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, <$A_BUNCH-OF{INVALID}TEXT\>, 60.2.1.1, 2.3.4.5',
'count' => 1,
'result' => 'Range Softblock with AC Disabled'
- ),
- array( 'xff' => '1.2.3.4, 50.2.1.1, 2001:4860:4001:802::1003, 2.3.4.5',
+ ],
+ [ 'xff' => '1.2.3.4, 50.2.1.1, 2001:4860:4001:802::1003, 2.3.4.5',
'count' => 2,
'result' => 'Range6 Hardblock'
- ),
- );
+ ],
+ ];
}
/**
# Set up the target
$u = User::newFromName( $username );
- if ( $u->getID() == 0 ) {
+ if ( $u->getId() == 0 ) {
$u->addToDatabase();
TestUser::setPasswordForUser( $u, 'TotallyObvious' );
}