function PrivateMethodUnitTestTrait::getMethod

Same name and namespace in other branches
  1. 11.x core/modules/ckeditor5/tests/src/Traits/PrivateMethodUnitTestTrait.php \Drupal\Tests\ckeditor5\Traits\PrivateMethodUnitTestTrait::getMethod()
  2. 10 core/modules/ckeditor5/tests/src/Traits/PrivateMethodUnitTestTrait.php \Drupal\Tests\ckeditor5\Traits\PrivateMethodUnitTestTrait::getMethod()

Gets a protected/private method to test.

Parameters

string $fqcn: A fully qualified classname.

string $name: The method name.

Return value

\ReflectionMethod The accessible method.

File

core/modules/ckeditor5/tests/src/Traits/PrivateMethodUnitTestTrait.php, line 23

Class

PrivateMethodUnitTestTrait
Provides methods to test protected/private methods in unit tests.

Namespace

Drupal\Tests\ckeditor5\Traits

Code

protected static function getMethod(string $fqcn, string $name) : \ReflectionMethod {
  $class = new \ReflectionClass($fqcn);
  $method = $class->getMethod($name);
  $method->setAccessible(TRUE);
  return $method;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.