$madeAt = wfTimestamp( TS_MW );
// delta to stop one-off errors when things happen to go over a second mark.
- $delta = abs( $madeAt - $block->mTimestamp );
+ $delta = abs( $madeAt - $block->getTimestamp() );
$this->assertLessThan(
2,
$delta,
$block = new Block();
$block->setTarget( $target );
$block->setBlocker( $blocker );
- $block->mReason = $insBlock['desc'];
- $block->mExpiry = 'infinity';
+ $block->setReason( $insBlock['desc'] );
+ $block->setExpiry( 'infinity' );
$block->isCreateAccountBlocked( $insBlock['ACDisable'] );
$block->isHardblock( $insBlock['isHardblock'] );
$block->isAutoblocking( $insBlock['isAutoBlocking'] );
$xffblocks = Block::getBlocksForIPList( $list, true );
$this->assertEquals( $exCount, count( $xffblocks ), 'Number of blocks for ' . $xff );
$block = Block::chooseBlock( $xffblocks, $list );
- $this->assertEquals( $exResult, $block->mReason, 'Correct block type for XFF header ' . $xff );
- }
-
- /**
- * @covers Block::__construct
- */
- public function testDeprecatedConstructor() {
- $this->hideDeprecated( 'Block::__construct with multiple arguments' );
- $username = 'UnthinkablySecretRandomUsername';
- $reason = 'being irrational';
-
- # Set up the target
- $u = User::newFromName( $username );
- if ( $u->getId() == 0 ) {
- $u->addToDatabase();
- TestUser::setPasswordForUser( $u, 'TotallyObvious' );
- }
- unset( $u );
-
- # Make sure the user isn't blocked
- $this->assertNull(
- Block::newFromTarget( $username ),
- "$username should not be blocked"
- );
-
- # Perform the block
- $block = new Block(
- /* address */ $username,
- /* user */ 0,
- /* by */ $this->getTestSysop()->getUser()->getId(),
- /* reason */ $reason,
- /* timestamp */ 0,
- /* auto */ false,
- /* expiry */ 0
- );
- $block->insert();
-
- # Check target
$this->assertEquals(
- $block->getTarget()->getName(),
- $username,
- "Target should be set properly"
- );
-
- # Check supplied parameter
- $this->assertEquals(
- $block->mReason,
- $reason,
- "Reason should be non-default"
- );
-
- # Check default parameter
- $this->assertFalse(
- (bool)$block->appliesToRight( 'createaccount' ),
- "Account creation should not be blocked by default"
+ $exResult, $block->getReason(), 'Correct block type for XFF header ' . $xff
);
}