Fix TestCase::invokePrivate to work with static classes

This commit is contained in:
Vincent Petry 2016-06-01 13:59:37 +02:00
parent 5ad8fa7675
commit 5b1eb416d8
No known key found for this signature in database
GPG Key ID: AF8F9EFC56562186
1 changed files with 6 additions and 1 deletions

View File

@ -166,7 +166,12 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase {
* @return mixed
*/
protected static function invokePrivate($object, $methodName, array $parameters = array()) {
$reflection = new \ReflectionClass(get_class($object));
if (is_string($object)) {
$className = $object;
} else {
$className = get_class($object);
}
$reflection = new \ReflectionClass($className);
if ($reflection->hasMethod($methodName)) {
$method = $reflection->getMethod($methodName);