X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fmodules%2Fblock_test%2Fsrc%2FContextProvider%2FMultipleStaticContext.php;fp=web%2Fcore%2Fmodules%2Fblock%2Ftests%2Fmodules%2Fblock_test%2Fsrc%2FContextProvider%2FMultipleStaticContext.php;h=dc89d5c64965d575b9b37b90156bb98254b7f143;hp=9ca81329036986fb1d22a40f5a7fe792097cb259;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/block/tests/modules/block_test/src/ContextProvider/MultipleStaticContext.php b/web/core/modules/block/tests/modules/block_test/src/ContextProvider/MultipleStaticContext.php index 9ca813290..dc89d5c64 100644 --- a/web/core/modules/block/tests/modules/block_test/src/ContextProvider/MultipleStaticContext.php +++ b/web/core/modules/block/tests/modules/block_test/src/ContextProvider/MultipleStaticContext.php @@ -4,9 +4,8 @@ namespace Drupal\block_test\ContextProvider; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Entity\EntityManagerInterface; -use Drupal\Core\Plugin\Context\Context; -use Drupal\Core\Plugin\Context\ContextDefinition; use Drupal\Core\Plugin\Context\ContextProviderInterface; +use Drupal\Core\Plugin\Context\EntityContext; use Drupal\Core\Session\AccountInterface; /** @@ -47,9 +46,8 @@ class MultipleStaticContext implements ContextProviderInterface { public function getRuntimeContexts(array $unqualified_context_ids) { $current_user = $this->userStorage->load($this->account->id()); - $context1 = new Context(new ContextDefinition('entity:user', 'User A'), $current_user); - - $context2 = new Context(new ContextDefinition('entity:user', 'User B'), $current_user); + $context1 = EntityContext::fromEntity($current_user, 'User A'); + $context2 = EntityContext::fromEntity($current_user, 'User B'); $cacheability = new CacheableMetadata(); $cacheability->setCacheContexts(['user']);