public function ContextAwarePluginBaseTest::testGetContextValue in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php \Drupal\KernelTests\Core\Plugin\Context\ContextAwarePluginBaseTest::testGetContextValue()
@covers ::getContextValue @group legacy
File
- core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Context/ ContextAwarePluginBaseTest.php, line 71
Class
- ContextAwarePluginBaseTest
- @coversDefaultClass \Drupal\Core\Plugin\ContextAwarePluginBase
Namespace
Drupal\KernelTests\Core\Plugin\ContextCode
public function testGetContextValue() {
// Assert that the context value passed in the plugin configuration is
// available.
$this
->assertSame('Alpha', $this->plugin
->getContextValue('nato_letter'));
// It should be possible to access the context via the $contexts property,
// but it should trigger a deprecation notice.
$this
->addExpectedDeprecationMessage('The $contexts property is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use methods of \\Drupal\\Component\\Plugin\\ContextAwarePluginInterface instead. See https://www.drupal.org/project/drupal/issues/3080631 for more information.');
$this
->assertSame('Alpha', $this->plugin->contexts['nato_letter']
->getContextValue());
}