You are here

public function ContextAwarePluginBaseTest::testGetContextDefinition in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php \Drupal\KernelTests\Core\Plugin\Context\ContextAwarePluginBaseTest::testGetContextDefinition()

@covers ::getContextDefinition

File

core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php, line 60

Class

ContextAwarePluginBaseTest
@coversDefaultClass \Drupal\Core\Plugin\ContextAwarePluginBase

Namespace

Drupal\KernelTests\Core\Plugin\Context

Code

public function testGetContextDefinition() {

  // 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');
}