本文整理汇总了PHP中TestingAccessWrapper::newFromObject方法的典型用法代码示例。如果您正苦于以下问题:PHP TestingAccessWrapper::newFromObject方法的具体用法?PHP TestingAccessWrapper::newFromObject怎么用?PHP TestingAccessWrapper::newFromObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestingAccessWrapper
的用法示例。
在下文中一共展示了TestingAccessWrapper::newFromObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: makeBlobStore
protected function makeBlobStore($methods = null, $rl = null)
{
$blobStore = $this->getMockBuilder('MessageBlobStore')->setConstructorArgs([$rl])->setMethods($methods)->getMock();
$access = TestingAccessWrapper::newFromObject($blobStore);
$access->wanCache = $this->wanCache;
return $blobStore;
}
示例2: setUp
function setUp()
{
parent::setUp();
require_once __DIR__ . '/../data/helpers/WellProtectedClass.php';
$this->raw = new WellProtectedClass();
$this->wrapped = TestingAccessWrapper::newFromObject($this->raw);
}
示例3: testGetParsedFooter
/**
* @dataProvider provideContentObjs
*/
public function testGetParsedFooter(CollaborationHubContent $content, $id)
{
$expected = ["<p><b>Test</b> content footer\n</p>", '', ''];
$wc = TestingAccessWrapper::newFromObject($content);
$actual = $wc->getParsedFooter(Title::newMainPage(), new ParserOptions());
$this->assertEquals($expected[$id], $actual, $id);
}
开发者ID:wikimedia,项目名称:mediawiki-extensions-CollaborationKit,代码行数:10,代码来源:CollaborationHubContentTest.php
示例4: testNormalizeThrottleConditions
/**
* @dataProvider provideNormalizeThrottleConditions
*/
public function testNormalizeThrottleConditions($condition, $normalized)
{
$throttler = new Throttler($condition);
$throttler->setLogger(new NullLogger());
$throttlerPriv = \TestingAccessWrapper::newFromObject($throttler);
$this->assertSame($normalized, $throttlerPriv->conditions);
}
示例5: testConstructor
public function testConstructor()
{
try {
$provider = new BotPasswordSessionProvider();
$this->fail('Expected exception not thrown');
} catch (\InvalidArgumentException $ex) {
$this->assertSame('MediaWiki\\Session\\BotPasswordSessionProvider::__construct: priority must be specified', $ex->getMessage());
}
try {
$provider = new BotPasswordSessionProvider(array('priority' => SessionInfo::MIN_PRIORITY - 1));
$this->fail('Expected exception not thrown');
} catch (\InvalidArgumentException $ex) {
$this->assertSame('MediaWiki\\Session\\BotPasswordSessionProvider::__construct: Invalid priority', $ex->getMessage());
}
try {
$provider = new BotPasswordSessionProvider(array('priority' => SessionInfo::MAX_PRIORITY + 1));
$this->fail('Expected exception not thrown');
} catch (\InvalidArgumentException $ex) {
$this->assertSame('MediaWiki\\Session\\BotPasswordSessionProvider::__construct: Invalid priority', $ex->getMessage());
}
$provider = new BotPasswordSessionProvider(array('priority' => 40));
$priv = \TestingAccessWrapper::newFromObject($provider);
$this->assertSame(40, $priv->priority);
$this->assertSame('_BPsession', $priv->sessionCookieName);
$this->assertSame(array(), $priv->sessionCookieOptions);
$provider = new BotPasswordSessionProvider(array('priority' => 40, 'sessionCookieName' => null));
$priv = \TestingAccessWrapper::newFromObject($provider);
$this->assertSame('_BPsession', $priv->sessionCookieName);
$provider = new BotPasswordSessionProvider(array('priority' => 40, 'sessionCookieName' => 'Foo', 'sessionCookieOptions' => array('Bar')));
$priv = \TestingAccessWrapper::newFromObject($provider);
$this->assertSame('Foo', $priv->sessionCookieName);
$this->assertSame(array('Bar'), $priv->sessionCookieOptions);
}
示例6: testConstructor
public function testConstructor()
{
$provider = new ThrottlePreAuthenticationProvider();
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$config = new \HashConfig(['AccountCreationThrottle' => 123, 'PasswordAttemptThrottle' => [['count' => 5, 'seconds' => 300]]]);
$provider->setConfig($config);
$this->assertSame(['accountCreationThrottle' => [['count' => 123, 'seconds' => 86400]], 'passwordAttemptThrottle' => [['count' => 5, 'seconds' => 300]]], $providerPriv->throttleSettings);
$accountCreationThrottle = \TestingAccessWrapper::newFromObject($providerPriv->accountCreationThrottle);
$this->assertSame([['count' => 123, 'seconds' => 86400]], $accountCreationThrottle->conditions);
$passwordAttemptThrottle = \TestingAccessWrapper::newFromObject($providerPriv->passwordAttemptThrottle);
$this->assertSame([['count' => 5, 'seconds' => 300]], $passwordAttemptThrottle->conditions);
$provider = new ThrottlePreAuthenticationProvider(['accountCreationThrottle' => [['count' => 43, 'seconds' => 10000]], 'passwordAttemptThrottle' => [['count' => 11, 'seconds' => 100]]]);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$config = new \HashConfig(['AccountCreationThrottle' => 123, 'PasswordAttemptThrottle' => [['count' => 5, 'seconds' => 300]]]);
$provider->setConfig($config);
$this->assertSame(['accountCreationThrottle' => [['count' => 43, 'seconds' => 10000]], 'passwordAttemptThrottle' => [['count' => 11, 'seconds' => 100]]], $providerPriv->throttleSettings);
$cache = new \HashBagOStuff();
$provider = new ThrottlePreAuthenticationProvider(['cache' => $cache]);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$provider->setConfig(new \HashConfig(['AccountCreationThrottle' => [['count' => 1, 'seconds' => 1]], 'PasswordAttemptThrottle' => [['count' => 1, 'seconds' => 1]]]));
$accountCreationThrottle = \TestingAccessWrapper::newFromObject($providerPriv->accountCreationThrottle);
$this->assertSame($cache, $accountCreationThrottle->cache);
$passwordAttemptThrottle = \TestingAccessWrapper::newFromObject($providerPriv->passwordAttemptThrottle);
$this->assertSame($cache, $passwordAttemptThrottle->cache);
}
示例7: getInstance
protected function getInstance(array $args = [])
{
$req = new RememberMeAuthenticationRequest();
$reqWrapper = \TestingAccessWrapper::newFromObject($req);
$reqWrapper->expiration = $args[0];
return $req;
}
示例8: setUp
protected function setUp()
{
parent::setUp();
$this->cache = new WANObjectCache(['cache' => new HashBagOStuff(), 'pool' => 'testcache-hash', 'relayer' => new EventRelayerNull([])]);
$wanCache = TestingAccessWrapper::newFromObject($this->cache);
/** @noinspection PhpUndefinedFieldInspection */
$this->internalCache = $wanCache->cache;
}
示例9: testMatch
public function testMatch()
{
$token = \TestingAccessWrapper::newFromObject(new Token('sekret', 'salty', false));
$test = $token->toStringAtTimestamp(time() - 10);
$this->assertTrue($token->match($test));
$this->assertTrue($token->match($test, 12));
$this->assertFalse($token->match($test, 8));
$this->assertFalse($token->match('ee2f7a2488dea9176c224cfb400d43be5644fdea-\\'));
}
示例10: testConstructor
public function testConstructor()
{
$config = new \HashConfig(['EnableEmail' => true, 'EmailAuthentication' => true]);
$provider = new EmailNotificationSecondaryAuthenticationProvider();
$provider->setConfig($config);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$this->assertTrue($providerPriv->sendConfirmationEmail);
$provider = new EmailNotificationSecondaryAuthenticationProvider(['sendConfirmationEmail' => false]);
$provider->setConfig($config);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$this->assertFalse($providerPriv->sendConfirmationEmail);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:EmailNotificationSecondaryAuthenticationProviderTest.php
示例11: testGetData
/**
* @covers ResourceLoaderClientHtml::__construct
* @covers ResourceLoaderClientHtml::setModules
* @covers ResourceLoaderClientHtml::setModuleStyles
* @covers ResourceLoaderClientHtml::setModuleScripts
* @covers ResourceLoaderClientHtml::getData
* @covers ResourceLoaderClientHtml::getContext
*/
public function testGetData()
{
$context = self::makeContext();
$context->getResourceLoader()->register(self::makeSampleModules());
$client = new ResourceLoaderClientHtml($context);
$client->setModules(['test', 'test.private.bottom', 'test.private.top', 'test.top', 'test.unregistered']);
$client->setModuleStyles(['test.styles.mixed', 'test.styles.mixed.user.empty', 'test.styles.private', 'test.styles.pure', 'test.unregistered.styles']);
$client->setModuleScripts(['test.scripts', 'test.scripts.mixed.user.empty', 'test.scripts.top', 'test.unregistered.scripts']);
$expected = ['states' => ['test.private.top' => 'loading', 'test.private.bottom' => 'loading', 'test.styles.pure' => 'ready', 'test.styles.mixed.user.empty' => 'ready', 'test.styles.private' => 'ready', 'test.scripts' => 'loading', 'test.scripts.top' => 'loading', 'test.scripts.mixed.user.empty' => 'ready'], 'general' => ['top' => ['test.top'], 'bottom' => ['test']], 'styles' => ['test.styles.mixed', 'test.styles.pure'], 'scripts' => ['top' => ['test.scripts.top'], 'bottom' => ['test.scripts']], 'embed' => ['styles' => ['test.styles.private'], 'general' => ['top' => ['test.private.top'], 'bottom' => ['test.private.bottom']]]];
$access = TestingAccessWrapper::newFromObject($client);
$this->assertEquals($expected, $access->getData());
}
示例12: testGCFraudFilters
function testGCFraudFilters()
{
$this->setMwGlobals(array('wgGlobalCollectGatewayEnableMinfraud' => true));
$options = $this->getDonorTestData();
$options['email'] = 'somebody@wikipedia.org';
$class = $this->testAdapterClass;
$gateway = $this->getFreshGatewayObject($options);
$gateway->runAntifraudFilters();
$this->assertEquals('reject', $gateway->getValidationAction(), 'Validation action is not as expected');
$exposed = TestingAccessWrapper::newFromObject($gateway);
$this->assertEquals(157.5, $exposed->risk_score, 'RiskScore is not as expected');
}
示例13: setUp
protected function setUp()
{
parent::setUp();
if ($this->getCliArg('use-wanobjectcache')) {
$name = $this->getCliArg('use-wanobjectcache');
$this->cache = ObjectCache::getWANInstance($name);
} else {
$this->cache = new WANObjectCache(['cache' => new HashBagOStuff(), 'pool' => 'testcache-hash', 'relayer' => new EventRelayerNull([])]);
}
$wanCache = TestingAccessWrapper::newFromObject($this->cache);
$this->internalCache = $wanCache->cache;
}
示例14: compareMessages
private function compareMessages($msg, $msg2)
{
$this->assertSame($msg->getKey(), $msg2->getKey(), 'getKey');
$this->assertSame($msg->getKeysToTry(), $msg2->getKeysToTry(), 'getKeysToTry');
$this->assertSame($msg->getParams(), $msg2->getParams(), 'getParams');
$this->assertSame($msg->getFormat(), $msg2->getFormat(), 'getFormat');
$this->assertSame($msg->getLanguage(), $msg2->getLanguage(), 'getLanguage');
$msg = TestingAccessWrapper::newFromObject($msg);
$msg2 = TestingAccessWrapper::newFromObject($msg2);
foreach (array('interface', 'useDatabase', 'title') as $key) {
$this->assertSame($msg->{$key}, $msg2->{$key}, $key);
}
}
示例15: compareMessages
private function compareMessages($msg, $msg2)
{
$this->assertSame($msg->getKey(), $msg2->getKey(), 'getKey');
$this->assertSame($msg->getKeysToTry(), $msg2->getKeysToTry(), 'getKeysToTry');
$this->assertSame($msg->getParams(), $msg2->getParams(), 'getParams');
$this->assertSame($msg->getFormat(), $msg2->getFormat(), 'getFormat');
$this->assertSame($msg->getLanguage(), $msg2->getLanguage(), 'getLanguage');
$msg = TestingAccessWrapper::newFromObject($msg);
$msg2 = TestingAccessWrapper::newFromObject($msg2);
$this->assertSame($msg->interface, $msg2->interface, 'interface');
$this->assertSame($msg->useDatabase, $msg2->useDatabase, 'useDatabase');
$this->assertSame($msg->title ? $msg->title->getFullText() : null, $msg2->title ? $msg2->title->getFullText() : null, 'title');
}