Mercurial > hg > isophonics-drupal-site
diff core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,28 @@ +<?php + +namespace Drupal\Tests\Component\Plugin; + +use Drupal\Component\Plugin\FallbackPluginManagerInterface; +use Drupal\Component\Plugin\PluginManagerBase; + +/** + * Stubs \Drupal\Component\Plugin\FallbackPluginManagerInterface. + * + * We have to stub \Drupal\Component\Plugin\FallbackPluginManagerInterface for + * \Drupal\Tests\Component\Plugin\PluginManagerBaseTest so that we can + * implement ::getFallbackPluginId(). + * + * We do this so we can have it just return the plugin ID passed to it, with + * '_fallback' appended. + */ +class StubFallbackPluginManager extends PluginManagerBase implements FallbackPluginManagerInterface { + + /** + * {@inheritdoc} + */ + public function getFallbackPluginId($plugin_id, array $configuration = []) { + // Minimally implement getFallbackPluginId so that we can test it. + return $plugin_id . '_fallback'; + } + +}