MediaWiki
1.28.0
|
Circumvent access restrictions on object internals. More...
Public Member Functions | |
__call ($method, $args) | |
__get ($name) | |
__set ($name, $value) | |
Static Public Member Functions | |
static | newFromClass ($className) |
Allow access to non-public static methods and properties of the class. More... | |
static | newFromObject ($object) |
Return the same object, without access restrictions. More... | |
Public Attributes | |
mixed | $object |
The object, or the class name for static-only access. More... | |
Private Member Functions | |
getMethod ($name) | |
Return a property and make it accessible. More... | |
getProperty ($name) | |
Return a property and make it accessible. More... | |
isStatic () | |
Circumvent access restrictions on object internals.
This can be helpful for writing tests that can probe object internals, without having to modify the class under test to accomodate.
Wrap an object with private methods as follows: $title = TestingAccessWrapper::newFromObject( Title::newFromDBkey( $key ) );
You can access private and protected instance methods and variables: $formatter = $title->getTitleFormatter();
TODO:
Definition at line 17 of file TestingAccessWrapper.php.
TestingAccessWrapper::__call | ( | $method, | |
$args | |||
) |
Definition at line 46 of file TestingAccessWrapper.php.
References $args, $object, getMethod(), and isStatic().
TestingAccessWrapper::__get | ( | $name | ) |
Definition at line 67 of file TestingAccessWrapper.php.
References $name, getProperty(), and isStatic().
TestingAccessWrapper::__set | ( | $name, | |
$value | |||
) |
Definition at line 57 of file TestingAccessWrapper.php.
References $name, $value, getProperty(), and isStatic().
|
private |
Return a property and make it accessible.
string | $name |
Definition at line 86 of file TestingAccessWrapper.php.
References $name.
Referenced by __call().
|
private |
Return a property and make it accessible.
ReflectionClass::getProperty() fails if the private property is defined in a parent class. This works more like ReflectionClass::getMethod().
string | $name |
ReflectionException |
Definition at line 103 of file TestingAccessWrapper.php.
References $name.
|
private |
Definition at line 77 of file TestingAccessWrapper.php.
|
static |
Allow access to non-public static methods and properties of the class.
Use non-static access,
Definition at line 37 of file TestingAccessWrapper.php.
Referenced by TestingAccessWrapperTest\setUp(), PrefixSearchTest\setUp(), SearchEnginePrefixTest\setUp(), SearchEnginePrefixTest\tearDown(), PrefixSearchTest\tearDown(), ExtensionProcessorTest\testGlobalSettingsDocumentedInSchema(), ResourceLoaderTest\testMakeLoaderImplementScript(), ResourceLoaderTest\testMakeLoaderImplementScriptInvalid(), MediaWiki\Auth\ThrottlerTest\testNormalizeThrottleConditions2(), and TestingAccessWrapperTest\testStaticConstructorException().
|
static |
Return the same object, without access restrictions.
Definition at line 24 of file TestingAccessWrapper.php.
References $object.
Referenced by ApiMessageTest\compareMessages(), MediaWiki\Session\SessionBackendTest\getBackend(), MediaWiki\Session\TestUtils\getDummySession(), MediaWiki\Session\TestUtils\getDummySessionBackend(), MediaWiki\Auth\RememberMeAuthenticationRequestTest\getInstance(), MediaWiki\Auth\AuthManagerTest\getMockSessionProvider(), MediaWiki\Session\PHPSessionHandlerTest\getResetter(), MediaWiki\Auth\AuthManagerTest\initializeManager(), MessageBlobStoreTest\makeBlobStore(), MediaWikiTestCase\restoreLoggers(), MediaWikiTestCase\setLogger(), TestingAccessWrapperTest\setUp(), WANObjectCacheTest\setUp(), RedisBagOStuffTest\setUp(), SwiftFileBackendTest\setUp(), MediaWiki\Auth\AbstractAuthenticationProviderTest\testAbstractAuthenticationProvider(), MediaWiki\Session\SessionBackendTest\testAddData(), MediaWiki\Session\SessionTest\testArrayAccess(), FileBackendTest\testAsyncWrites(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testAuthentication(), MediaWiki\Session\SessionManagerTest\testBackendRegistration(), MediaWiki\Session\SessionProviderTest\testBasics(), MediaWiki\Session\CookieSessionProviderTest\testBasics(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testBeginLinkAttempt(), ApiLoginTest\testBotPassword(), UserTest\testCheckAndSetTouched(), CentralIdLookupTest\testCheckAudience(), ApiMainTest\testCheckConditionalRequestHeaders(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testCheckPasswordValidity(), MediaWiki\Session\SessionTest\testClear(), ApiMainTest\testConditionalRequestHeadersOutput(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testConfig(), MediaWiki\Auth\EmailNotificationSecondaryAuthenticationProviderTest\testConstructor(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testConstructor(), MediaWiki\Auth\CheckBlocksSecondaryAuthenticationProviderTest\testConstructor(), MediaWiki\Auth\ThrottlePreAuthenticationProviderTest\testConstructor(), MediaWiki\Session\SessionTest\testConstructor(), MediaWiki\Auth\ThrottlerTest\testConstructor(), MediaWiki\Session\CookieSessionProviderTest\testConstructor(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testConstructor(), MediaWiki\Session\SessionBackendTest\testConstructor(), MediaWiki\Session\BotPasswordSessionProviderTest\testConstructor(), MediaWiki\Session\SessionManagerTest\testConstructor(), TestingAccessWrapperTest\testConstructorException(), MediaWiki\Auth\ConfirmLinkSecondaryAuthenticationProviderTest\testContinueLinkAttempt(), MediaWiki\Session\CookieSessionProviderTest\testCookieData(), MediaWiki\Session\SessionTest\testDataAccess(), MediaWiki\Session\SessionBackendTest\testDelaySave(), MediaWiki\Session\SessionBackendTest\testDirty(), MediaWiki\Session\PHPSessionHandlerTest\testDisabled(), ApiDocumentationTest\testDocumentationExists(), MediaWiki\Session\PHPSessionHandlerTest\testEnableFlags(), HashBagOStuffTest\testExpire(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testFailResponse(), MediaWiki\Session\SessionProviderTest\testGetAllowedUserRights(), MediaWiki\Session\BotPasswordSessionProviderTest\testGetAllowedUserRights(), FileBackendTest\testGetContentType(), MediaWiki\Session\CookieSessionProviderTest\testGetCookie(), ResourceLoaderClientHtmlTest\testGetData(), MediaWiki\Session\SessionBackendTest\testGetData(), MediaWiki\Session\SessionManagerTest\testGetEmptySession(), MediaWiki\Auth\RememberMeAuthenticationRequestTest\testGetFieldInfo_2(), MediaWiki\Session\SessionManagerTest\testGetGlobalSession(), MediaWiki\Session\CookieSessionProviderTest\testGetLoginCookieExpiration(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetNewPasswordExpiry(), ApiBaseTest\testGetParameterFromSettings(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPassword(), BotPasswordTest\testGetPassword(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testGetPasswordFactory(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), MediaWiki\Session\SessionManagerTest\testGetProviders(), MediaWiki\Session\SessionManagerTest\testGetSessionFromInfo(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testGetSessionIdFromCookie(), ResourceLoaderWikiModuleTest\testGetTitleInfo(), MediaWiki\Logger\Monolog\KafkaHandlerTest\testHandlesNullFormatterResult(), MediaWiki\Session\SessionProviderTest\testHashToSessionId(), MediaWiki\Session\PHPSessionHandlerTest\testInstall(), BotPasswordTest\testInvalidateAllPasswordsForUser(), MediaWiki\Session\SessionManagerTest\testLoadSessionInfoFromStore(), ContentHandlerSanityTest\testMakeEmptyContent(), MediaWiki\Session\TokenTest\testMatch(), MediaWiki\Logger\MonologSpiTest\testMergeConfig(), MediaWiki\Logger\Monolog\LineFormatterTest\testNormalizeExceptionNoTrace(), MediaWiki\Logger\Monolog\LineFormatterTest\testNormalizeExceptionTrace(), MediaWiki\Auth\ThrottlerTest\testNormalizeThrottleConditions(), MediaWiki\Session\SessionBackendTest\testPersist(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testPersistSession(), MediaWiki\Session\CookieSessionProviderTest\testPersistSession(), MediaWiki\Session\CookieSessionProviderTest\testPersistSessionWithHook(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationDataEmail(), CdnCacheUpdateTest\testPurgeMergeWeb(), FileBackendTest\testReadAffinity(), MediaWiki\Session\SessionBackendTest\testRenew(), MediaWiki\Session\SessionBackendTest\testResetId(), MediaWiki\Session\SessionBackendTest\testResetIdOfGlobalSession(), FileBackendTest\testSanitizeOpHeaders(), BotPasswordTest\testSave(), MediaWiki\Session\SessionBackendTest\testSave(), MediaWiki\Session\SessionTest\testSecrets(), MessageTest\testSerialization(), MediaWiki\Session\PHPSessionHandlerTest\testSessionHandling(), MediaWiki\Session\SessionBackendTest\testSessionStuff(), MediaWiki\Session\CookieSessionProviderTest\testSetLoggedOutCookie(), MediaWiki\Auth\AbstractPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProviderTest\testSetPasswordResetFlag(), MediaWiki\Session\SessionBackendTest\testSetProviderMetadata(), MediaWiki\Session\SessionManagerTest\testShutdown(), MediaWiki\Auth\AuthManagerTest\testSingleton(), MediaWiki\Session\SessionBackendTest\testTakeOverGlobalSession(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProviderTest\testTestUserCanAuthenticate(), MediaWiki\Session\SessionTest\testTokens(), MediaWiki\Session\TokenTest\testToStringAtTimestamp(), MediaWiki\Auth\ResetPasswordSecondaryAuthenticationProviderTest\testTryReset(), MediaWiki\Session\SessionBackendTest\testUnpersist(), MediaWiki\Session\SessionBackendTest\testUnpersistOfGlobalSession(), MediaWiki\Session\ImmutableSessionProviderWithCookieTest\testUnpersistSession(), UserTest\testUserGetRightsHooks(), OutputPageTest\testVaryHeaders(), and MediaWiki\Session\PHPSessionHandlerTest\testWrongInstance().
mixed TestingAccessWrapper::$object |
The object, or the class name for static-only access.
Definition at line 19 of file TestingAccessWrapper.php.
Referenced by __call(), and newFromObject().