本文整理汇总了PHP中TestingAccessWrapper::setDefaultUserOptions方法的典型用法代码示例。如果您正苦于以下问题:PHP TestingAccessWrapper::setDefaultUserOptions方法的具体用法?PHP TestingAccessWrapper::setDefaultUserOptions怎么用?PHP TestingAccessWrapper::setDefaultUserOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestingAccessWrapper
的用法示例。
在下文中一共展示了TestingAccessWrapper::setDefaultUserOptions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetDefaultUserOptions
public function testSetDefaultUserOptions()
{
$this->initializeManager();
$context = \RequestContext::getMain();
$reset = new \ScopedCallback([$context, 'setLanguage'], [$context->getLanguage()]);
$context->setLanguage('de');
$this->setMwGlobals('wgContLang', \Language::factory('zh'));
$user = \User::newFromName(self::usernameForCreation());
$user->addToDatabase();
$oldToken = $user->getToken();
$this->managerPriv->setDefaultUserOptions($user, false);
$user->saveSettings();
$this->assertNotEquals($oldToken, $user->getToken());
$this->assertSame('zh', $user->getOption('language'));
$this->assertSame('zh', $user->getOption('variant'));
$user = \User::newFromName(self::usernameForCreation());
$user->addToDatabase();
$oldToken = $user->getToken();
$this->managerPriv->setDefaultUserOptions($user, true);
$user->saveSettings();
$this->assertNotEquals($oldToken, $user->getToken());
$this->assertSame('de', $user->getOption('language'));
$this->assertSame('zh', $user->getOption('variant'));
$this->setMwGlobals('wgContLang', \Language::factory('en'));
$user = \User::newFromName(self::usernameForCreation());
$user->addToDatabase();
$oldToken = $user->getToken();
$this->managerPriv->setDefaultUserOptions($user, true);
$user->saveSettings();
$this->assertNotEquals($oldToken, $user->getToken());
$this->assertSame('de', $user->getOption('language'));
$this->assertSame(null, $user->getOption('variant'));
}