accounts/common/tests/_support/ProtectedCaller.php

22 lines
418 B
PHP
Raw Normal View History

<?php
2019-12-05 03:22:27 +05:30
declare(strict_types=1);
namespace common\tests\_support;
use ReflectionClass;
2019-12-05 03:22:27 +05:30
/**
* @deprecated
*/
trait ProtectedCaller {
2019-12-05 03:22:27 +05:30
protected function callProtected(object $object, string $methodName, ...$args) {
$class = new ReflectionClass($object);
2019-12-05 03:22:27 +05:30
$method = $class->getMethod($methodName);
$method->setAccessible(true);
return $method->invokeArgs($object, $args);
}
}