TestHelper
Static helper methods to assist unit testing PHP code.
| since |
1.0 |
|---|---|
| package |
Joomla Framework |
Methods
getValue
Helper method that gets a protected or private property in a class by reflection.
getValue(string|object objectOrClass, propertyName) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- objectOrClass
string|objectThe object from which to return the property value.- propertyName
stringThe name of the property to return.
Response
mixedThe value of the property.
invoke
Helper method that invokes a protected or private method in a class by reflection.
invoke( object, methodName, mixed||string|int methodArgs) :
Example usage:
$this->assertTrue(TestHelper::invoke($this->object, 'methodName', 123)); where 123 is the input parameter for your method
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- object
objectThe object on which to invoke the method.- methodName
stringThe name of the method to invoke.- methodArgs
array<string|int, mixed>The arguments to pass forward to the method being called
Response
mixed
setValue
Helper method that sets a protected or private property in a class by reflection.
setValue( object, propertyName, value) :
| since |
1.0 |
|---|---|
| throws |
|
Arguments
- object
objectThe object for which to set the property.- propertyName
stringThe name of the property to set.- value
mixedThe value to set for the property.
Response
void