You are here

protected function ApiTestAbstract::invokeMethod in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::invokeMethod()
  2. 8.2 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::invokeMethod()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::invokeMethod()
  2. 8.3 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::invokeMethod()

Invokes protected or private method of given object.

Parameters

BaseApiAbstract $object: Object with protected or private method to invoke.

string $methodName: Name of the property to invoke.

array $parameters: Array of parameters to be passed to invoking method.

Return value

mixed Value invoked method will return or exception.

File

api-sdk-php/tests/unit/ApiTestAbstract.php, line 153

Class

ApiTestAbstract
Class ApiTestAbstract @package Smartling\Tests

Namespace

Smartling\Tests\Unit

Code

protected function invokeMethod($object, $methodName, array $parameters = []) {
  $reflection = new \ReflectionClass(get_class($object));
  $method = $reflection
    ->getMethod($methodName);
  $method
    ->setAccessible(true);
  return $method
    ->invokeArgs($object, $parameters);
}