class StubReflectionFactory in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory
- 9 core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory
Override ReflectionFactory because ::createInstance() calls a static method.
We have to override getPluginClass so that we can stub out its return value.
Hierarchy
- class \Drupal\Tests\Component\Plugin\Factory\StubReflectionFactory extends \Drupal\Component\Plugin\Factory\ReflectionFactory
Expanded class hierarchy of StubReflectionFactory
File
- core/
tests/ Drupal/ Tests/ Component/ Plugin/ Factory/ ReflectionFactoryTest.php, line 143 - Contains \Drupal\Tests\Component\Plugin\Factory\ReflectionFactoryTest.
Namespace
Drupal\Tests\Component\Plugin\FactoryView source
class StubReflectionFactory extends ReflectionFactory {
/**
* {@inheritdoc}
*/
public static function getPluginClass($plugin_id, $plugin_definition = NULL, $required_interface = NULL) {
// Return the class name from the plugin definition.
return $plugin_definition[$plugin_id]['class'];
}
}