MediaWiki REL1_28
|
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. | |
static | newFromObject ( $object) |
Return the same object, without access restrictions. | |
Public Attributes | |
mixed | $object |
The object, or the class name for static-only access. | |
Private Member Functions | |
getMethod ( $name) | |
Return a property and make it accessible. | |
getProperty ( $name) | |
Return a property and make it accessible. | |
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, 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.
|
static |
Return the same object, without access restrictions.
Definition at line 24 of file TestingAccessWrapper.php.
Referenced by MediaWiki\Logger\Monolog\LineFormatterTest\testNormalizeExceptionNoTrace(), and MediaWiki\Logger\Monolog\LineFormatterTest\testNormalizeExceptionTrace().
mixed TestingAccessWrapper::$object |
The object, or the class name for static-only access.
Definition at line 19 of file TestingAccessWrapper.php.