[ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ], [ 'mycustomjsprotected', 'bogus' ] ],
- [ [ 'badaccess-group0' ] ]
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
* @covers Title::checkUserConfigPermissions
*/
public function testJsonConfigEditPermissions() {
+ $prefix = MediaWikiServices::getInstance()->getContentLanguage()->
+ getFormattedNsText( NS_PROJECT );
$this->setUser( $this->userName );
$this->setTitle( NS_USER, $this->userName . '/test.json' );
[ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ] ],
- [ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ]
+ [ [ 'badaccess-group0' ], [ 'mycustomjsonprotected', 'bogus' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
- [ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ]
+ [ [ 'badaccess-group0' ], [ 'mycustomcssprotected', 'bogus' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ], [ 'customjsprotected', 'bogus' ] ],
- [ [ 'badaccess-group0' ] ]
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
[ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ],
[ [ 'badaccess-group0' ] ],
- [ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ]
+ [ [ 'badaccess-group0' ], [ 'customjsonprotected', 'bogus' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
- [ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ]
+ [ [ 'badaccess-group0' ], [ 'customcssprotected', 'bogus' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
[ [ 'badaccess-group0' ] ],
[ [ 'badaccess-group0' ] ],
- [ [ 'badaccess-group0' ] ]
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-groups' ] ]
+ );
+ }
+
+ /**
+ * @todo This should use data providers like the other methods here.
+ * @covers Title::checkUserConfigPermissions
+ */
+ public function testPatrolActionConfigEditPermissions() {
+ $this->setUser( 'anon' );
+ $this->setTitle( NS_USER, 'ToPatrolOrNotToPatrol' );
+ $this->runConfigEditPermissions(
+ [ [ 'badaccess-group0' ] ],
+
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-group0' ] ],
+
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-group0' ] ],
+ [ [ 'badaccess-groups' ] ]
);
}
$resultMyJs,
$resultUserCss,
$resultUserJson,
- $resultUserJs
+ $resultUserJs,
+ $resultPatrol
) {
$this->setUserPerm( '' );
$result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
$result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
$this->assertEquals( $resultUserJs, $result );
+ $this->setUserPerm( '' );
+ $result = $this->title->getUserPermissionsErrors( 'patrol', $this->user );
+ $this->assertEquals( reset( $resultPatrol[0] ), reset( $result[0] ) );
+
$this->setUserPerm( [ 'edituserjs', 'edituserjson', 'editusercss' ] );
$result = $this->title->getUserPermissionsErrors( 'bogus', $this->user );
$this->assertEquals( [ [ 'badaccess-group0' ] ], $result );
'Useruser', 'test', '23:00, 31 December 1969', '127.0.8.1',
$wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ],
$this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
+
+ // partial block message test
+ $this->user->mBlockedby = $this->user->getName();
+ $this->user->mBlock = new Block( [
+ 'address' => '127.0.8.1',
+ 'by' => $this->user->getId(),
+ 'reason' => 'no reason given',
+ 'timestamp' => $now,
+ 'sitewide' => false,
+ 'expiry' => 10,
+ ] );
+
+ $this->assertEquals( [ [ 'blockedtext-partial',
+ '[[User:Useruser|Useruser]]', 'no reason given', '127.0.0.1',
+ 'Useruser', null, '23:00, 31 December 1969', '127.0.8.1',
+ $wgLang->timeanddate( wfTimestamp( TS_MW, $now ), true ) ] ],
+ $this->title->getUserPermissionsErrors( 'move-target', $this->user ) );
}
}