accounts/tests/codeception/common/_support/ProtectedCaller.php
2018-04-17 23:47:25 +03:00

17 lines
370 B
PHP

<?php
namespace tests\codeception\common\_support;
use ReflectionClass;
trait ProtectedCaller {
protected function callProtected($object, string $function, ...$args) {
$class = new ReflectionClass($object);
$method = $class->getMethod($function);
$method->setAccessible(true);
return $method->invokeArgs($object, $args);
}
}