function ProtectedPrivatesTest::getAccessibleMethod
Same name in other branches
- 4.0.x modules/phpunit_example/tests/src/Unit/ProtectedPrivatesTest.php \Drupal\Tests\phpunit_example\Unit\ProtectedPrivatesTest::getAccessibleMethod()
Get an accessible method using reflection.
2 calls to ProtectedPrivatesTest::getAccessibleMethod()
- ProtectedPrivatesTest::testPrivateAdd in modules/
phpunit_example/ tests/ src/ Unit/ ProtectedPrivatesTest.php - Test ProtectedPrivate::privateAdd().
- ProtectedPrivatesTest::testPrivateAddBadData in modules/
phpunit_example/ tests/ src/ Unit/ ProtectedPrivatesTest.php - Test ProtectedPrivate::privateAdd() with bad data.
File
-
modules/
phpunit_example/ tests/ src/ Unit/ ProtectedPrivatesTest.php, line 46
Class
- ProtectedPrivatesTest
- ProtectedPrivates unit testing of restricted methods.
Namespace
Drupal\Tests\phpunit_example\UnitCode
public function getAccessibleMethod($class_name, $method_name) {
$class = new \ReflectionClass($class_name);
$method = $class->getMethod($method_name);
$method->setAccessible(TRUE);
return $method;
}