public function ContextAwarePluginTraitTest::testGetContextValueFromConfiguration in Drupal 9
@covers ::getContextValue @group legacy
File
- core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Context/ ContextAwarePluginTraitTest.php, line 85
Class
- ContextAwarePluginTraitTest
- @coversDefaultClass \Drupal\Core\Plugin\ContextAwarePluginTrait
Namespace
Drupal\KernelTests\Core\Plugin\ContextCode
public function testGetContextValueFromConfiguration() {
$this
->expectDeprecation('Passing context values to plugins via configuration is deprecated in drupal:9.1.0 and will be removed before drupal:10.0.0. Instead, call ::setContextValue() on the plugin itself. See https://www.drupal.org/node/3120980');
$configuration = [
'context' => [
'nato_letter' => 'Alpha',
],
];
$this->plugin = new TestContextAwarePlugin($configuration, 'the_sisko', $this->plugin
->getPluginDefinition());
// Assert that the context value passed in the plugin configuration is
// available.
$this
->assertSame('Alpha', $this->plugin
->getContextValue('nato_letter'));
}