* When a user is autoblocked a cookie is set with which to track them
* in case they log out and change IP addresses.
* @link https://phabricator.wikimedia.org/T5233
+ * @covers User::trackBlockWithCookie
*/
public function testAutoblockCookies() {
// Set up the bits of global configuration that we use.
/**
* Make sure that no cookie is set to track autoblocked users
* when $wgCookieSetOnAutoblock is false.
+ * @covers User::trackBlockWithCookie
*/
public function testAutoblockCookiesDisabled() {
// Set up the bits of global configuration that we use.
* When a user is autoblocked and a cookie is set to track them, the expiry time of the cookie
* should match the block's expiry, to a maximum of 24 hours. If the expiry time is changed,
* the cookie's should change with it.
+ * @covers User::trackBlockWithCookie
*/
public function testAutoblockCookieInfiniteExpiry() {
$this->setMwGlobals( [
$block->delete();
}
+ /**
+ * @covers User::getBlockedStatus
+ */
public function testSoftBlockRanges() {
global $wgUser;
/**
* Test that a modified BlockID cookie doesn't actually load the relevant block (T152951).
+ * @covers User::trackBlockWithCookie
*/
public function testAutoblockCookieInauthentic() {
// Set up the bits of global configuration that we use.
/**
* The BlockID cookie is normally verified with a HMAC, but not if wgSecretKey is not set.
* This checks that a non-authenticated cookie still works.
+ * @covers User::trackBlockWithCookie
*/
public function testAutoblockCookieNoSecretKey() {
// Set up the bits of global configuration that we use.
$this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
}
+ /**
+ * @covers User::newFromActorId
+ */
public function testActorId() {
$domain = MediaWikiServices::getInstance()->getDBLoadBalancer()->getLocalDomainID();
$this->hideDeprecated( 'User::selectFields' );
'User::newFromActorId works for an anonymous user' );
}
+ /**
+ * @covers User::newFromAnyId
+ */
public function testNewFromAnyId() {
// Registered user
$user = $this->getTestUser()->getUser();
/**
* Block cookie should be set for IP Blocks if
* wgCookieSetOnIpBlock is set to true
+ * @covers User::trackBlockWithCookie
*/
public function testIpBlockCookieSet() {
$this->setMwGlobals( [
/**
* Block cookie should NOT be set when wgCookieSetOnIpBlock
* is disabled
+ * @covers User::trackBlockWithCookie
*/
public function testIpBlockCookieNotSet() {
$this->setMwGlobals( [
/**
* When an ip user is blocked and then they log in, cookie block
* should be invalid and the cookie removed.
+ * @covers User::trackBlockWithCookie
*/
public function testIpBlockCookieIgnoredWhenUserLoggedIn() {
$this->setMwGlobals( [