function ContextAwarePluginTraitTest::testGetContextDefinition

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php \Drupal\KernelTests\Core\Plugin\Context\ContextAwarePluginTraitTest::testGetContextDefinition()
  2. 10 core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php \Drupal\KernelTests\Core\Plugin\Context\ContextAwarePluginTraitTest::testGetContextDefinition()
  3. 9 core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php \Drupal\KernelTests\Core\Plugin\Context\ContextAwarePluginTraitTest::testGetContextDefinition()

Tests get context definition.

File

core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php, line 70

Class

ContextAwarePluginTraitTest
Tests Drupal\Core\Plugin\ContextAwarePluginTrait.

Namespace

Drupal\KernelTests\Core\Plugin\Context

Code

public function testGetContextDefinition() : void {
  // The context is not defined, so an exception will be thrown.
  $this->expectException(ContextException::class);
  $this->expectExceptionMessage('The person context is not a valid context.');
  $this->plugin
    ->getContextDefinition('person');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.