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, string propertyName) : mixed
since |
1.0 |
---|---|
throws |
|
Arguments
- objectOrClass
string|object
The object from which to return the property value.- propertyName
string
The name of the property to return.
Response
mixed
The value of the property.
invoke
Helper method that invokes a protected or private method in a class by reflection.
invoke(object object, string methodName, array methodArgs) : mixed
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
object
The object on which to invoke the method.- methodName
string
The name of the method to invoke.- methodArgs
array
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 relfection.
setValue(object object, string propertyName, mixed value) : void
since |
1.0 |
---|---|
throws |
|
Arguments
- object
object
The object for which to set the property.- propertyName
string
The name of the property to set.- value
mixed
The value to set for the property.