public function ModuleTestController::testClassLoading in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php \Drupal\module_test\Controller\ModuleTestController::testClassLoading()
- 9 core/modules/system/tests/modules/module_test/src/Controller/ModuleTestController.php \Drupal\module_test\Controller\ModuleTestController::testClassLoading()
Returns the result of an autoloaded class's public method.
Return value
array Renderable array.
1 string reference to 'ModuleTestController::testClassLoading'
- module_test.routing.yml in core/
modules/ system/ tests/ modules/ module_test/ module_test.routing.yml - core/modules/system/tests/modules/module_test/module_test.routing.yml
File
- core/
modules/ system/ tests/ modules/ module_test/ src/ Controller/ ModuleTestController.php, line 40
Class
- ModuleTestController
- Controller routines for module_test routes.
Namespace
Drupal\module_test\ControllerCode
public function testClassLoading() {
$markup = NULL;
if (class_exists('Drupal\\module_autoload_test\\SomeClass')) {
$obj = new SomeClass();
$markup = $obj
->testMethod();
}
return [
'#markup' => $markup,
];
}