accounts/common/tests/_support/ProtectedCaller.php

22 lines
418 B
PHP
Raw Normal View History

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