<?php
use MediaWiki\Block\BlockRestrictionStore;
+use MediaWiki\Block\DatabaseBlock;
use MediaWiki\Block\Restriction\PageRestriction;
use MediaWiki\Block\Restriction\NamespaceRestriction;
use Wikimedia\TestingAccessWrapper;
$block = $this->insertBlock();
// Refresh the block from the database.
- $block = Block::newFromTarget( $block->getTarget() );
+ $block = DatabaseBlock::newFromTarget( $block->getTarget() );
$page = $this->newSpecialPage();
$pageSaturn = $this->getExistingTestPage( 'Saturn' );
$pageMars = $this->getExistingTestPage( 'Mars' );
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $badActor->getName(),
'user' => $badActor->getId(),
'by' => $sysop->getId(),
$block->insert();
// Refresh the block from the database.
- $block = Block::newFromTarget( $block->getTarget() );
+ $block = DatabaseBlock::newFromTarget( $block->getTarget() );
$page = $this->newSpecialPage();
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
}
$context = RequestContext::getMain();
// Create a block that will be updated.
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $badActor->getName(),
'user' => $badActor->getId(),
'by' => $sysop->getId(),
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertSame( '1', $block->isAutoblocking() );
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertCount( 2, $block->getRestrictions() );
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertFalse( $block->isSitewide() );
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertFalse( $block->isSitewide() );
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertFalse( $block->isSitewide() );
$this->assertTrue( $result );
- $block = Block::newFromTarget( $badActor );
+ $block = DatabaseBlock::newFromTarget( $badActor );
$this->assertSame( $reason, $block->getReason() );
$this->assertSame( $expiry, $block->getExpiry() );
$this->assertTrue( $block->isSitewide() );
$$var = $users[$$var];
}
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $blockedUser->getName(),
'user' => $blockedUser->getId(),
'by' => $blockPerformer->getId(),
$badActor = $this->getTestUser()->getUser();
$sysop = $this->getTestSysop()->getUser();
- $block = new \Block( [
+ $block = new DatabaseBlock( [
'address' => $badActor->getName(),
'user' => $badActor->getId(),
'by' => $sysop->getId(),