diff --git a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php index 5d5fe63..d6cc8c6 100644 --- a/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php +++ b/core/tests/Drupal/Tests/Component/Plugin/Factory/ReflectionFactoryTest.php @@ -137,6 +137,8 @@ public function testGetInstanceArguments($expected, $reflector_name, $plugin_id, /** * Override ReflectionFactory because ::createInstance() calls a static method. + * + * We have to override getPluginClass so that we can stub out its return value. */ class StubReflectionFactory extends ReflectionFactory { @@ -144,11 +146,16 @@ class StubReflectionFactory extends ReflectionFactory { * {@inheritdoc} */ public static function getPluginClass($plugin_id, $plugin_definition = NULL, $required_interface = NULL) { - $class = $plugin_definition["$plugin_id"]['class']; - return $class; + // Return the class name from the plugin definition. + return $plugin_definition[$plugin_id]['class']; } } +/** + * A stub class used by testGetInstanceArguments(). + * + * @see providerGetInstanceArguments() + */ class ArgumentsPluginId { public function __construct($plugin_id) { @@ -157,6 +164,11 @@ public function __construct($plugin_id) { } +/** + * A stub class used by testGetInstanceArguments(). + * + * @see providerGetInstanceArguments() + */ class ArgumentsMany { public function __construct( @@ -167,6 +179,11 @@ public function __construct( } +/** + * A stub class used by testGetInstanceArguments(). + * + * @see providerGetInstanceArguments() + */ class ArgumentsConfigArrayKey { public function __construct($config_name) { @@ -175,6 +192,11 @@ public function __construct($config_name) { } +/** + * A stub class used by testGetInstanceArguments(). + * + * @see providerGetInstanceArguments() + */ class ArgumentsAllNull { public function __construct($charismatic, $demure, $delightful, $electrostatic) { @@ -183,6 +205,11 @@ public function __construct($charismatic, $demure, $delightful, $electrostatic) } +/** + * A stub class used by testGetInstanceArguments(). + * + * @see providerGetInstanceArguments() + */ class ArgumentsNoConstructor { }