use MediaWiki\Block\BlockRestriction;
use MediaWiki\Block\Restriction\PageRestriction;
+use MediaWiki\Block\Restriction\NamespaceRestriction;
use Wikimedia\TestingAccessWrapper;
/**
public function testGetFormFields() {
$this->setMwGlobals( [
'wgEnablePartialBlocks' => false,
+ 'wgBlockAllowsUTEdit' => true,
] );
$page = $this->newSpecialPage();
$wrappedPage = TestingAccessWrapper::newFromObject( $page );
$this->assertArrayHasKey( 'Reason', $fields );
$this->assertArrayHasKey( 'CreateAccount', $fields );
$this->assertArrayHasKey( 'DisableUTEdit', $fields );
- $this->assertArrayHasKey( 'DisableUTEdit', $fields );
$this->assertArrayHasKey( 'AutoBlock', $fields );
$this->assertArrayHasKey( 'HardBlock', $fields );
$this->assertArrayHasKey( 'PreviousTarget', $fields );
$this->assertArrayNotHasKey( 'EditingRestriction', $fields );
$this->assertArrayNotHasKey( 'PageRestrictions', $fields );
+ $this->assertArrayNotHasKey( 'NamespaceRestrictions', $fields );
}
/**
$this->assertArrayHasKey( 'EditingRestriction', $fields );
$this->assertArrayHasKey( 'PageRestrictions', $fields );
+ $this->assertArrayHasKey( 'NamespaceRestrictions', $fields );
}
/**
public function testMaybeAlterFormDefaults() {
$this->setMwGlobals( [
'wgEnablePartialBlocks' => false,
+ 'wgBlockAllowsUTEdit' => true,
] );
$block = $this->insertBlock();
$block->setRestrictions( [
new PageRestriction( 0, $pageSaturn->getId() ),
new PageRestriction( 0, $pageMars->getId() ),
+ new NamespaceRestriction( 0, NS_TALK ),
] );
$block->insert();
/**
* @covers ::processForm()
*/
- public function testProcessFormRestictions() {
+ public function testProcessFormRestrictions() {
$this->setMwGlobals( [
'wgEnablePartialBlocks' => true,
] );
'Watch' => '0',
'EditingRestriction' => 'partial',
'PageRestrictions' => implode( "\n", $titles ),
+ 'NamespaceRestrictions' => '',
];
$result = $page->processForm( $data, $context );
'Watch' => '0',
'EditingRestriction' => 'partial',
'PageRestrictions' => implode( "\n", $titles ),
+ 'NamespaceRestrictions' => '',
];
$result = $page->processForm( $data, $context );