* @covers \MediaWiki\Permissions\PermissionManager::checkSpecialsAndNSPermissions
*/
public function testSpecialsAndNSPermissions() {
- global $wgNamespaceProtection;
$this->setUser( $this->userName );
$this->setTitle( NS_SPECIAL );
$this->assertEquals( [ [ 'badaccess-group0' ] ],
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
- $wgNamespaceProtection[NS_USER] = [ 'bogus' ];
-
+ $this->mergeMwGlobalArrayValue( 'wgNamespaceProtection', [
+ NS_USER => [ 'bogus' ]
+ ] );
+ $this->resetServices();
$this->setTitle( NS_USER );
$this->overrideUserPermissions( $this->user );
$this->assertEquals( [ [ 'badaccess-group0' ],
$this->assertEquals( [ [ 'protectedinterface', 'bogus' ] ],
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
- $wgNamespaceProtection = null;
-
+ $this->setMwGlobals( 'wgNamespaceProtection', null );
+ $this->resetServices();
$this->overrideUserPermissions( $this->user, 'bogus' );
$this->assertEquals( [],
$this->title->getUserPermissionsErrors( 'bogus', $this->user ) );
'address' => '127.0.8.1',
'by' => $this->user->getId(),
'reason' => 'no reason given',
- 'timestamp' => $prev + 3600,
+ 'timestamp' => $prev,
'auto' => true,
'expiry' => 0
] );
- $this->user->mBlock->setTimestamp( 0 );
$this->assertEquals( [ [ 'autoblockedtext',
- '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
- 'Useruser', null, 'infinite', '127.0.8.1',
+ "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
+ "\u{202A}Useruser\u{202C}", null, 'infinite', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $prev ), true ) ] ],
$this->title->getUserPermissionsErrors( 'move-target',
$this->user ) );
'expiry' => 10,
] );
$this->assertEquals( [ [ 'blockedtext',
- '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
- 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1',
+ "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
+ "\u{202A}Useruser\u{202C}", null, '23:00, 31 December 1969', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ],
$this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
# $action != 'read' && $action != 'createaccount' && $user->isBlockedFrom( $this )
] );
$errors = [ [ 'systemblockedtext',
- '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
- 'Useruser', 'test', 'infinite', '127.0.8.1',
+ "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
+ "\u{202A}Useruser\u{202C}", 'test', 'infinite', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ];
$this->assertEquals( $errors,
] );
$errors = [ [ 'blockedtext-partial',
- '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
- 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1',
+ "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
+ "\u{202A}Useruser\u{202C}", null, '23:00, 31 December 1969', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ];
$this->assertEquals( $errors,
] );
$errors = [ [ 'blockedtext',
- '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
- 'Useruser', null, 'infinite', '127.0.8.1',
+ "[[User:Useruser|\u{202A}Useruser\u{202C}]]", 'no reason given', '127.0.0.1',
+ "\u{202A}Useruser\u{202C}", null, 'infinite', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ];
$this->assertEquals( $errors,