本文整理汇总了PHP中TestingAccessWrapper类的典型用法代码示例。如果您正苦于以下问题:PHP TestingAccessWrapper类的具体用法?PHP TestingAccessWrapper怎么用?PHP TestingAccessWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TestingAccessWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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
示例2: 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;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:7,代码来源:MessageBlobStoreTest.php
示例3: setUp
function setUp()
{
parent::setUp();
require_once __DIR__ . '/../data/helpers/WellProtectedClass.php';
$this->raw = new WellProtectedClass();
$this->wrapped = TestingAccessWrapper::newFromObject($this->raw);
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:7,代码来源:TestingAccessWrapperTest.php
示例4: 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);
}
开发者ID:Gomyul,项目名称:mediawiki,代码行数:33,代码来源:BotPasswordSessionProviderTest.php
示例5: 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);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:25,代码来源:ThrottlePreAuthenticationProviderTest.php
示例6: getInstance
protected function getInstance(array $args = [])
{
$req = new RememberMeAuthenticationRequest();
$reqWrapper = \TestingAccessWrapper::newFromObject($req);
$reqWrapper->expiration = $args[0];
return $req;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:7,代码来源:RememberMeAuthenticationRequestTest.php
示例7: 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;
}
开发者ID:paladox,项目名称:mediawiki,代码行数:8,代码来源:WANObjectCacheTest.php
示例8: 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-\\'));
}
开发者ID:lourinaldi,项目名称:mediawiki,代码行数:9,代码来源:TokenTest.php
示例9: 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
示例10: 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;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:12,代码来源:WANObjectCacheTest.php
示例11: testGCFraudFilters
function testGCFraudFilters()
{
$this->setMwGlobals(array('wgGlobalCollectGatewayEnableMinfraud' => true));
$options = $this->getDonorTestData();
$options['email'] = '[email protected]';
$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');
}
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:12,代码来源:FraudFiltersTest.php
示例12: 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());
}
开发者ID:paladox,项目名称:mediawiki,代码行数:20,代码来源:ResourceLoaderClientHtmlTest.php
示例13: testConstructor
public function testConstructor()
{
$provider = new CheckBlocksSecondaryAuthenticationProvider();
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$config = new \HashConfig(['BlockDisablesLogin' => false]);
$provider->setConfig($config);
$this->assertSame(false, $providerPriv->blockDisablesLogin);
$provider = new CheckBlocksSecondaryAuthenticationProvider(['blockDisablesLogin' => true]);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$config = new \HashConfig(['BlockDisablesLogin' => false]);
$provider->setConfig($config);
$this->assertSame(true, $providerPriv->blockDisablesLogin);
}
开发者ID:paladox,项目名称:mediawiki,代码行数:13,代码来源:CheckBlocksSecondaryAuthenticationProviderTest.php
示例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);
}
}
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:13,代码来源:ApiMessageTest.php
示例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');
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:13,代码来源:ApiMessageTest.php
示例16: testMakeEmptyContent
/**
* @dataProvider provideHandlers
* @param ContentHandler $handler
*/
public function testMakeEmptyContent(ContentHandler $handler)
{
$content = $handler->makeEmptyContent();
$this->assertInstanceOf(Content::class, $content);
if ($handler instanceof TextContentHandler) {
// TextContentHandler::getContentClass() is protected, so bypass
// that restriction
$testingWrapper = TestingAccessWrapper::newFromObject($handler);
$this->assertInstanceOf($testingWrapper->getContentClass(), $content);
}
$handlerClass = get_class($handler);
$contentClass = get_class($content);
$this->assertTrue($content->isValid(), "{$handlerClass}::makeEmptyContent() did not return a valid content ({$contentClass}::isValid())");
}
开发者ID:paladox,项目名称:mediawiki,代码行数:18,代码来源:ContentHandlerSanityTest.php
示例17: testExpire
/**
* @covers HashBagOStuff::doGet
* @covers HashBagOStuff::expire
*/
public function testExpire()
{
$cache = new HashBagOStuff();
$cacheInternal = TestingAccessWrapper::newFromObject($cache);
$cache->set('foo', 1);
$cache->set('bar', 1, 10);
$cache->set('baz', 1, -10);
$this->assertEquals(0, $cacheInternal->bag['foo'][$cache::KEY_EXP], 'Indefinite');
// 2 seconds tolerance
$this->assertEquals(time() + 10, $cacheInternal->bag['bar'][$cache::KEY_EXP], 'Future', 2);
$this->assertEquals(time() - 10, $cacheInternal->bag['baz'][$cache::KEY_EXP], 'Past', 2);
$this->assertEquals(1, $cache->get('bar'), 'Key not expired');
$this->assertEquals(false, $cache->get('baz'), 'Key expired');
}
开发者ID:paladox,项目名称:mediawiki,代码行数:18,代码来源:HashBagOStuffTest.php
示例18: getDummySession
/**
* If you need a Session for testing but don't want to create a backend to
* construct one, use this.
* @param object $backend Object to serve as the SessionBackend
* @param int $index Index
* @return Session
*/
public static function getDummySession($backend = null, $index = -1)
{
$rc = new \ReflectionClass('MediaWiki\\Session\\Session');
if (!method_exists($rc, 'newInstanceWithoutConstructor')) {
\PHPUnit_Framework_Assert::markTestSkipped('ReflectionClass::newInstanceWithoutConstructor isn\'t available');
}
if ($backend === null) {
$backend = new DummySessionBackend();
}
$session = $rc->newInstanceWithoutConstructor();
$priv = \TestingAccessWrapper::newFromObject($session);
$priv->backend = $backend;
$priv->index = $index;
return $session;
}
开发者ID:Gomyul,项目名称:mediawiki,代码行数:22,代码来源:TestUtils.php
示例19: testAbstractAuthenticationProvider
public function testAbstractAuthenticationProvider()
{
$provider = $this->getMockForAbstractClass(AbstractAuthenticationProvider::class);
$providerPriv = \TestingAccessWrapper::newFromObject($provider);
$obj = $this->getMockForAbstractClass('Psr\\Log\\LoggerInterface');
$provider->setLogger($obj);
$this->assertSame($obj, $providerPriv->logger, 'setLogger');
$obj = AuthManager::singleton();
$provider->setManager($obj);
$this->assertSame($obj, $providerPriv->manager, 'setManager');
$obj = $this->getMockForAbstractClass('Config');
$provider->setConfig($obj);
$this->assertSame($obj, $providerPriv->config, 'setConfig');
$this->assertType('string', $provider->getUniqueId(), 'getUniqueId');
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:15,代码来源:AbstractAuthenticationProviderTest.php
示例20: testCheckAudience
public function testCheckAudience()
{
$mock = TestingAccessWrapper::newFromObject($this->getMockForAbstractClass('CentralIdLookup'));
$user = static::getTestSysop()->getUser();
$this->assertSame($user, $mock->checkAudience($user));
$user = $mock->checkAudience(CentralIdLookup::AUDIENCE_PUBLIC);
$this->assertInstanceOf('User', $user);
$this->assertSame(0, $user->getId());
$this->assertNull($mock->checkAudience(CentralIdLookup::AUDIENCE_RAW));
try {
$mock->checkAudience(100);
$this->fail('Expected exception not thrown');
} catch (InvalidArgumentException $ex) {
$this->assertSame('Invalid audience', $ex->getMessage());
}
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:16,代码来源:CentralIdLookupTest.php
注:本文中的TestingAccessWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论