X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fplugin_test%2Fsrc%2FPlugin%2FMockBlockManager.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fmodules%2Fplugin_test%2Fsrc%2FPlugin%2FMockBlockManager.php;h=de9fc3364d8e7ba461fa80eda63f10e04105b939;hp=443ab5d04090ca8f1e96cd672910b03f2ce49f21;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/system/tests/modules/plugin_test/src/Plugin/MockBlockManager.php b/web/core/modules/system/tests/modules/plugin_test/src/Plugin/MockBlockManager.php index 443ab5d04..de9fc3364 100644 --- a/web/core/modules/system/tests/modules/plugin_test/src/Plugin/MockBlockManager.php +++ b/web/core/modules/system/tests/modules/plugin_test/src/Plugin/MockBlockManager.php @@ -7,11 +7,13 @@ use Drupal\Component\Plugin\Discovery\StaticDiscovery; use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; use Drupal\Component\Plugin\Factory\ReflectionFactory; use Drupal\Core\Plugin\Context\ContextDefinition; +use Drupal\Core\Plugin\Context\EntityContextDefinition; /** * Defines a plugin manager used by Plugin API derivative unit tests. */ class MockBlockManager extends PluginManagerBase { + public function __construct() { // Create the object that can be used to return definitions for all the @@ -139,7 +141,11 @@ class MockBlockManager extends PluginManagerBase { // a TranslatableMarkup and we will do assertEqual() checks on arrays that // include ContextDefinition objects, and var_export() has problems // printing TranslatableMarkup objects. - return new ContextDefinition($data_type, (string) $label, $required); + $class = ContextDefinition::class; + if (strpos($data_type, 'entity:') === 0) { + $class = EntityContextDefinition::class; + } + return new $class($data_type, (string) $label, $required); } }